• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using a UIButton as cell accessory view in plain UITableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using a UIButton as cell accessory view in plain UITableView


  • Subject: Re: Using a UIButton as cell accessory view in plain UITableView
  • From: Tino Rachui <email@hidden>
  • Date: Thu, 3 Jun 2010 20:35:18 +0200

Thanks Kyle and Brian. Seem I wasn't too far off with my tentative solutions.
Regards,
Tino

Am 03.06.2010 um 18:15 schrieb Kyle Sluder:

> On Jun 3, 2010, at 8:38 AM, Tino Rachui <email@hidden> 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.
>
> You could set a tag on each button and use that to work back to the model object.
>
> --Kyle Sluder

_______________________________________________

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

References: 
 >Using a UIButton as cell accessory view in plain UITableView (From: Tino Rachui <email@hidden>)
 >Re: Using a UIButton as cell accessory view in plain UITableView (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: CFAttributedString and NSDATA
  • Next by Date: Re: Change the background colour of a window and toolbar
  • Previous by thread: Re: Using a UIButton as cell accessory view in plain UITableView
  • Next by thread: icon sizes
  • Index(es):
    • Date
    • Thread