I've got a UITableView
instance and implemented:
tableView:canEditRowAtIndexPath:
tableView:editingStyleForRowAtIndexPath:
tableView:shouldIndentWhileEditingRowAtIndexPath:
tableView:canMoveRowAtIndexPath:
tableView:moveRowAtIndexPath:toIndexPath:
After that I can see all my cells with reorder controls.
Apple's header says:
@property(nonatomic) BOOL showsReorderControl; // default is NO
If the default value is NO
why am I seeing the reorder controls?
Update:
I've also checked the value of property in tableView:cellForRowAtIndexPath:
right after when the cell is created:
(lldb) p [c showsReorderControl]
(BOOL) $1 = NO
When you return YES from tableView:canMoveRowAtIndexPath:
, it does the same thing as setting the showsReorderControl
to YES. These are just two different ways to enable the reorder control.
In fact, there is a third way - let's never complain that we don't have options! ;) From the documentation of tableView:canMoveRowAtIndexPath:
:
This method allows the delegate to specify that the reordering control for a the specified row not be shown. By default, the reordering control is shown if the data source implements the tableView:moveRowAtIndexPath:toIndexPath: method.
By reading the current Apple docs, it seems showsReorderControl
has no use at all.
UITableViewCell
For the reordering control to appear, you must not only set this property but implement the UITableViewDataSource method tableView:moveRowAtIndexPath:toIndexPath:.
UITableViewDataSource
By default, the reordering control is shown if the data source implements the tableView:moveRowAtIndexPath:toIndexPath: method.
From this documentation I conclude that:
1- The only way to show the reordering control is by implementing tableView:moveRowAtIndexPath:toIndexPath:
, which shows the control in all cells.
2- If you want a cell to not display the control, you must return NO from tableView:canMoveRowAtIndexPath:
3- showsReorderControl
has no control on wether or not the reorder control is shown.
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