How to edit tableview cell on TAP instead of swipe – Swift
I have a
UITableViewController and at the moment, the user can swipe left on the cell to reveal an ‘add to favourites’ button. I would now like to add an icon to the cell that the user can tap to reveal the this button (does the same thing as swiping to the left). This will just act as a visual aid for the users who do not know swiping left will do the same thing.
TableView, I use the following code to ‘close the cell’ when the user has pressed the button:
itemsTableView.setEditing(false, animated: true)
From this I assumed that to manually open the cell I would simply call:
//Get cell let cell:TableViewCell = itemsTableView.cellForRowAtIndexPath(NSIndexPath(forRow: sender.tag, inSection: 0)) as! TableViewCell //Open cell to reveal button cell.setEditing(true, animated: true)
Unfortunately this does not work. So I would like to know what is the function that is called when a user swipes to the left of a cell and how can I replicate it when a user taps on the icon?
- NSMutableArray check if object already exists
- how to display image from documents folder in of iphone to image ViewI
- subnormal IEEE 754 floating point numbers support on iOS ARM devices (iPhone 4)
- Why are Objective-C delegates usually given the property assign instead of retain?
- How to set unsafe area background color for ios 11
- Call function only after reloadData has finished
Solutions Collect From Internet About “How to edit tableview cell on TAP instead of swipe – Swift”
I don’t think you’re going to be able to do it, sorry. This feature relies on the UITableView’s pan gesture recognizer. When the user pans sideways, the table view checks the
editActions... delegate method and, if we have edit actions, inserts a private confirmation view behind the cell and allows the cell to be moved to reveal it. You can’t trigger that behavior programmatically as far as I can tell.
This would be a reason — one of many very good reasons — for sticking with a third-party scrollable cell class. In this way, the cell is a horizontal scroll view and you just scroll it in code.
- How to get UIKeyboard size with Apple iPhone SDK
- How to add Root privileges to my OSX application?
- Storing authentication token on iOS
- Modify NSEvent to send a different key than the one that was pressed
- Swift – Make UIViewController visible while adding new ViewController animated from TOP (via self.present)
- Saving PFObject NSCoding
- Swift 3; Range 'Out of bounds'
- Xcode 4 / iOS – Send an email using SMTP from inside my app
- Certificate identity 'iPhone Developer: ' appears more than once in the keychain. The codesign tool requires there only be one
- UISearchBar CGContext ERROR
- Return to root view in IOS
- Property cannot be found on forward class object?
- How to programmatically check the iPad version/model
- ShareKit Compile Issue – JSONKit not found
- Error Thread 1: Breakpoint 1.1