LoginSignup
0
1

More than 5 years have passed since last update.

Swift3 TableViewをスワイプしたらイメージボタンを表示させる

Last updated at Posted at 2017-11-02

スワイプの時にイメージボタンを表示

Assetsに「delete」という名前で保存されている

スクリーンショット 2017-11-14 18.33.34.png

swift3

 func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]?
{
        let deleteAction = UITableViewRowAction(style: .normal, title: stockWidth) { (rowAction:UITableViewRowAction, indexPath:IndexPath) -> Void in
           print("削除イメージボタンクリック") 

        }
        //イメージボタン追加
        deleteAction.backgroundColor = UIColor(patternImage: UIImage(named: "delete")!)

        //複数のボタンを追加したい場合アクションを追加して下の配列に追加すればOK
        return [deleteAction]
}
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1