• 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: Design for custom tableviewcell button action
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Design for custom tableviewcell button action


  • Subject: Re: Design for custom tableviewcell button action
  • From: WT <email@hidden>
  • Date: Thu, 25 Jun 2009 10:54:35 +0200

On Jun 25, 2009, at 10:26 AM, Alexander Spohr wrote:

Am 25.06.2009 um 10:16 schrieb WT:

I had exactly the same problem and here's how I solved it.

Why didn’t you put the cell into the controllers nib?
Make an outlet in your controller to reach the cell and just return it when you need it?


The second nib seems to much work. And you get a speed bump by loading it.

- (UITableViewCell*) tableView: (UITableView*) table_view
       cellForRowAtIndexPath: (NSIndexPath*) index_path
{
  static NSString* cellID = @"cellID";

  CustomCell* cell = (CustomCell*) [table_view
      dequeueReusableCellWithIdentifier: cellID];

  if (cell == nil)
  {
      cell = customCellOutlet;

      // other one-time cell configuration stuff here
  }

  // per-cell configuration stuff here
}

Because -tableView:cellForRowAtIndexPath: needs to return a different cell object for each visible row. Your code above returns always the same object, the one table view cell archived in the nib, which means that changing the data in one cell would change the data in all visible cells, and all visible cells would have the same data all the time.


Wagner

_______________________________________________

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


  • Follow-Ups:
    • Re: Design for custom tableviewcell button action
      • From: Alexander Spohr <email@hidden>
References: 
 >Design for custom tableviewcell button action (From: Bryan Hansen <email@hidden>)
 >Re: Design for custom tableviewcell button action (From: WT <email@hidden>)
 >Re: Design for custom tableviewcell button action (From: Alexander Spohr <email@hidden>)

  • Prev by Date: linking error
  • Next by Date: Re: linking error
  • Previous by thread: Re: Design for custom tableviewcell button action
  • Next by thread: Re: Design for custom tableviewcell button action
  • Index(es):
    • Date
    • Thread