UITableView スワイプでセルを削除する
- iOS
- 
                         2017-05-24                                                                                                 - 更新:2018-02-15 2017-05-24                                                                                                 - 更新:2018-02-15
この記事は最終更新日から1年以上経過しています。
                    
                    簡単に実装できるので楽ですね。
UITableViewをOutlet接続しておきます。
@IBOutlet weak var table: UITableView!
削除処理の実装
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
    if editingStyle == .delete {
        table.deleteRows(at: [indexPath], with: .fade)
    }
}
Xcode: 8.3.2
Swift: 3.1
OS: Sierra 10.12
                        この記事がお役に立ちましたらシェアお願いします
                    
                    
                 
                                            
                        3,296 views 
                                                                    
                    
                








 Fedoraインストール時にごちゃごちゃになったHDの整理の... (25/02/14)
 Fedoraインストール時にごちゃごちゃになったHDの整理の... (25/02/14)