Re: Custom UITableViewCell parent is NIL
Re: Custom UITableViewCell parent is NIL
- Subject: Re: Custom UITableViewCell parent is NIL
- From: Quincey Morris <email@hidden>
- Date: Mon, 07 Apr 2014 21:13:57 -0700
On Apr 7, 2014, at 20:43 , Michael de Haan <email@hidden> wrote:
> I have implemented a custom UITableViewCell in a (test) project with batch deletions, following the guidelines of the sample code "MultiSelectTableView". This works as expected. However, "swipe to Delete" does not work.
> To debug this, I created a close replica using the standard UITableViewCell, and implemented this code, triggered by the dataSourceMethod, "cellForRowAtIndexPath”.
> In the case of the Custom UITableViewCell, the first iteration of "parentView = view.superview" produces "nil".
>
> I am curious if this has anything to do with the problem, and if so, is this expected?
a. Which direction did you swipe? In a couple of iOS 7 apps I just tried, I had to swipe from right to left (outside of edit mode), whereas left to right didn’t do anything. I recall (though perhaps incorrectly, I don’t know now) that swiping left to right started a deletion in older versions of iOS.
b. Why do you expect that the swipe gesture recognizer would necessarily be attached to the table cell? It may well be attached to the tableview, or to some other view.
c. Why do you expect that the table cell would have a superview during ‘tableView:cellForRowAtIndexPath:’? This data source method is used to *create* cells, and they’re not inserted in the view hierarchy, I would assume, until after that method returns.
_______________________________________________
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