2016-04-14 6 views
0

UITableViewControllerでスワイプアクションを実装したいが表示されない。UITableViewControllerのスワイプアクションがスウィフトに表示されない

は私のコードを参照してください:

override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { 
     } 

     override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { 
      return true 
     } 

     override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? { 
      let keep = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Profiter"){(UITableViewRowAction,NSIndexPath) -> Void in 

       print("hello") 
      } 

      return [keep] 
     } 
+0

は、これらの機能を持って使用するようにしてください。 sectionIndexTitlesを使用していますか?これにより、スワイプのアクション位置がスクロールされ、画面の左側の代わりにsectionIndexTitlesの左に移動されます。 – HalR

答えて

0

は一般のUITableViewに編集を与えるために働く

override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? { 
    let keep = UITableViewRowAction(style: .Normal, title: "Dude") { action, index in 
     print("hello") 
    } 
    keep.backgroundColor = UIColor.redColor() 
    return [keep] 
} 
+0

ありがとう!それは作品です! –

+0

実際に私のtableViewのパラメータで "ユーザーのやり取り"を無効にしました –

関連する問題