Re: Custom UITableViewCell parent is NIL
On Apr 7, 2014, at 9:32 PM, Michael de Haan m...@comcast.net wrote: It still however leaves me puzzled as to why I cannot implement Swipe to delete. (the 2 usual suspects), ie -(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath; -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath are implemented. I realize that this will come across as a “is it plugged in?” sort of question, but have you put a breakpoint, or added a NSLog(), to each of those methods to see if they’re actually being called? And if -tableView:canEditRowAtIndexPath: is being called, are there any cases where you return NO? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom UITableViewCell parent is NIL
On Apr 8, 2014, at 6:16 AM, Steve Christensen puns...@mac.com wrote: On Apr 7, 2014, at 9:32 PM, Michael de Haan m...@comcast.net wrote: It still however leaves me puzzled as to why I cannot implement Swipe to delete. (the 2 usual suspects), ie -(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath; -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath are implemented. I realize that this will come across as a “is it plugged in?” sort of question, but have you put a breakpoint, or added a NSLog(), to each of those methods to see if they’re actually being called? And if -tableView:canEditRowAtIndexPath: is being called, are there any cases where you return NO? Turns out that the issue seems to revolve around the property of the UITableView allowsMultipleSelectionDuringEditing, which has to be NO for swipe-to-Delete and YES for batch deletions, each being exclusive of the other. So, in the end, I set the appropriate value (YES) in the edit mode for batch deletions, then back to the baseline value (NO) for swipe-to-delete. Thank you all again. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Custom UITableViewCell parent is NIL
I wonder if I might get some insight into this issue. 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 latter, this code -(void)analyzeCellForGestures:(UITableViewCell*)cell{ UIView *view = (CustomUITableViewCell*)cell; NSArray * gestures; while (view ![view isKindOfClass:[UITableView class]]) { gestures = view.gestureRecognizers; [gestures enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { NSLog(@Gesture for: %@: %@, [view class], obj); }]; UIView * parentView = view.superview; view = parentView; } } shows gesture recognizers associated with the tableView. 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? Thanks in advance. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom UITableViewCell parent is NIL
On Apr 7, 2014, at 20:43 , Michael de Haan m...@comcast.net 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com