I've to reordering UITableView
rows without show the default red minus button because I need to show my custom image and I don't need to remove cell from UITableView
. Is there a way for reordering rows even if table is not in editing mode ?
When the user taps a row, the table view calls the delegate method tableView (_:didSelectRowAt:). At this point, your app performs the action, such as displaying the details of the selected hiking trail:
If you’re using a UITableViewController to display a table view, you get the behavior by setting the clearsSelectionOnViewWillAppear property to true. Otherwise, you can clear the selection in your view controller’s viewWillAppear (_:) method:
There is only one section in the Table View so 1 needs to be returned in the numberOfSections (in:) method. The number of rows is equal to the number of items in the cars array so the count property of the array class is used.
The default is false. Determines whether user can select a row while the table view is in editing mode. The default is false. Determines whether users can select a more than one row while in editing mode. The default is false. When the user taps a row, the table view calls the delegate method tableView (_:didSelectRowAt:).
You will need to add this delegate method to not show the delete button
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
return UITableViewCellEditingStyleNone;
}
I think, you should check out the followings: https://www.cocoacontrols.com/controls/reordertableviewcontroller https://www.cocoacontrols.com/controls/reorderabletableview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With