Re: UITableViewCell showsReorderControl does nothing
Re: UITableViewCell showsReorderControl does nothing
- Subject: Re: UITableViewCell showsReorderControl does nothing
- From: Matt Neuburg <email@hidden>
- Date: Mon, 3 Jan 2011 08:36:17 -0800
Hard to say, because you never know, when the docs and the behavior disagree (which happens a *lot*), which of them is wrong. But since experimentation demonstrates that just two methods give you 100% complete control over which cells can be reordered (implementation of tableView:moveRowAtIndexPath:toIndexPath: plus the veto power of tableView:canMoveRowAtIndexPath:), I personally am glad it isn't any more complicated. I think of UITableViewCell's showsReorderControl like UITableViewCell's selected property. You'd never set this directly because the cell lives inside a table view and you want the table to manage selection; you don't want to do anything behind the table's back. Similarly, since the table has sufficient power through its data source methods to manage reordering, I don't want to interfere at the level of the individual table cell. m.
On Jan 2, 2011, at 4:40 PM, Roland King wrote:
> ok that's what I've effectively done by implementing 3), which makes 2) return YES for all rows, which is what I wanted.
>
> So, err what is 1) for? It's a property, it exists, it's in the documentation but it doesn't seem to do anything.
>
> On 03-Jan-2011, at 5:14 AM, Matt Neuburg wrote:
>
>> On Fri, 31 Dec 2010 21:52:29 +0800, Roland King <email@hidden> said:
>>> I've read the UITableView / UITableViewCell documentation for reordering several times now. As I understand it in order to have a reorder control shown when the table goes into editing mode you have to have the following
>>>
>>> 1) showsReorderControl of the UITableViewCell == YES
>>> 2) tableView:canMoveRowAtIndexPath: must return YES --- which is does by default if you
>>> 3) implement tableView:moveRowAtIndexPath
>>>
>>> I've implemented 3) and not touched the default implementation of 2). It doesn't matter however what I set showsReorderControl on my UITableViewCells to, YES, or NO, the reorder control shows every time the table goes into editing mode.
>>
>> Don't touch (1). Use (2) to prevent the reorder control from appearing on individual rows. m.
>>
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden