Get the superview (possible the superview's superview) for the button (sender). 
 Once you have the cell, ask the table for the index path.

Brian


On Jun 3, 2010, at 11:38 AM, Tino Rachui wrote:

> On the iPhone I have a plain table. Every cell should have a UIButton as 
> accessory view. I configure each cell like this:
> 
> -(UITableViewCell*)tableView:(UITableView*)theTableView 
> cellForRowAtIndexPath:(NSIndexPath*)indexPath {
> ...
> 
> UIButton *btnAdd =  [UIButton buttonWithType:UIButtonTypeContactAdd]; 
> [btnAdd addTarget:self action:@selector(foo:) 
> forControlEvents:UIControlEventTouchUpInside];
> 
> cell.accessoryView = btnAdd;
> ...
> }
> 
> When somebody taps the add button in a row 'foo' will be called. In 'foo' 
> what is a reasonable way to figure 
> out which row the tapped button belongs to? 
> 'accessoryButtonTappedForRowWithIndexPah' is unfortunately not called
> when an accessory view is set for the row at indexPath.
> None of the possible solutions I have in mind for this looks really appealing 
> and clean to me and I'm afraid I 
> simply miss the obvious here.
> 
> So if anybody has any hint I'd be thankful.
> 
> TIA,
> Tino
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/brianslick%40mac.com
> 
> This email sent to briansl...@mac.com

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to