Wednesday 15 April 2015

uitableview - Swipe to Delete and the "More" button (like in Mail app on iOS 7) -


How to create a "more" button when users swipe a cell in a table view (like mail in iOS 7

I see this information here and in the Coca-Touch forum, but I have not found the answer and I am hoping that I can give myself a solution to anyone.

I would like that when a user swipe a table view cell to display more than one editing button (delete it when it is default). You can hit the iOS app to remove the mail app, but a "more" button appears.

Enter image details here

< DivX = "post-text" itemprop = "text">

How implemented

It seems that iOS 8 opens this API, such functionality signals exist in beta 2.

To do some work, implement two types of methods on your UITWview representative (see for an example).

The document states that the table view: CommitEditingStyle: forRowAtIndexPath is:

"Not called for editing tasks using UITableViewRowAction - the handler of the action will be applied instead."

However, swiping does not work without it even if the method stub is empty, still need it, for now it's most obviously in beta 2 The bug is there.


source

Basic Answer:


< H1> Update:

Sample code (in SWIFT) with this job:

This easy-to-follow pattern in the sample code is MasterViewController.swift, and only with this method You get the behavior shown in OP screenshots:

  Override funk tableview (Tableview: UITABLE View, EditActionForraAreateAandPap IndexPath: NSIndexpath) - & gt; [AnyObject]? {Var moreRowAction = UITableViewRowAction (style: UITableViewRowActionStyle.Default, title: "more", handler: {action, index in println ("more action");); MoreRowAction.backgroundColor = UIColor (red: 0.2 9 8, green: 0.851, blue: 0.3 9 22, alpha: 1.0); Var deleteRowAction = UITableViewRowAction (style: UITableViewRowActionStyle.Default, title: "Delete", Handler: {action, indexpath in println ("DELETEĆ¢ ?? ¢ actions");}); Return [deleteRowAction, overaction]; }    

No comments:

Post a Comment