Why is the leading swipe action also duplicated as a trailing action?
Use this code to prevent trailingSwipeAction()
func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle
{
return .none
}
- or
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
return UISwipeActionsConfiguration(actions: [])
}
How do I disable the default Delete swipe action and display my custom swipe action instead?
Based on ChillY's answer to this question (Why is the leading swipe action also duplicated as a trailing action?), I realized the problem was that I was returning nil
instead of UISwipeActionsConfiguration(actions: [])
.
Now I just have to figure out why the swipes are not disappearing after the action has been executed. Any ideas?
How to add image in UITableViewRowAction?
Finally in iOS 11, SWIFT 4 We can add add image in UITableView's swipe action with help of UISwipeActionsConfiguration
@available(iOS 11.0, *)
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let action = UIContextualAction(style: .normal, title: "Files", handler: { (action,view,completionHandler ) in
//do stuff
completionHandler(true)
})
action.image = UIImage(named: "apple.png")
action.backgroundColor = .red
let configuration = UISwipeActionsConfiguration(actions: [action])
return configuration
}
WWDC video at 28.34
Apple Doc
Note: I have used 50*50 points apple.png image with 50 tableview
row height
Swiping right on a UITableViewCell
No, there Is no such native API as of now.
Related Topics
Issue with Returning a Directory Enumerator from Nsfilemanager Using Enumeratoraturl in Swift
Swiftui CPU High Usage on Real-Time Foreach View Updating (Macos)
How to Get Reliable Timing for My Audio App
Facebook Graphrequest for Swift 5 and Facebook Sdk 5
iOS App Extension - Action - Custom Data
Check If Class Has a Value for a Key
Swift Short Syntax of Execution
Need Clarification of Type Casting Operator in Swift
Programmatically Place Partial Image Over Another in UIview Using Swift 3
Loading Image from Assets to Nsimage Keep Getting Error, Expecting Nsimage.Name
Errors Encountered While Discovering Extensions: Error Domain=Pluginkit Code=13 "Query Cancelled"
How to Access The Firebase Topics a User Is Subscribed To
No Exact Matches in Call to Instance Method Error Message in Swift
iOS 12 Wkwebview Not Working with Redirects