Bonus Track
Custom Table Cells in Interface Builder
Resources
19 comments
Thanks for that! I've been using nibs in the same way, but I learned a couple of tricks. I waasn't adding the subview and I love the way you use the outlet instead of digging through the objects in the nib. That's much cleaner.
This is a great guide to using Interface Builder to design table cells. Thanks!
One thing that worries me is whether there is some overhead in loading the table cell's Nib file multiple times, once for each uncached cell. Would it be possible to load the Nib only once, and then to clone/copy the un-frozen object each time you need it?
James: Before I get too worried about performance, I like to measure. :-)
A rough measurement on the Simulator here says it takes around 1.5 milliseconds on average to load the Nib file. I put 1000 rows in the table, and it needed 8 reusable cells to scroll through the whole list. So roughly 12 milliseconds of overhead for the convenience of custom cells in IB.
It's definitely something you want to keep measuring, but I wouldn't go to the trouble of copying/cloning unless I had to.
Mike,
I think your videos are great. I was left with a number of questions i hope you can help with
1.at 15:15 when you are loading the Nib file for ProductTableCell there is a parameter "options" which is never visible on screen. What do you set it to?
2. at 13:58 I can not make the connection from productCell to ProductTableCell. I am sure I got this working when you put the video up but I can't today. I have run through the video a few times and I think I am doing things right. Any idea what not making this connection is caused by?
3. These videos are not yet available as paid products correct? Any idea when they will be?
Thanks,
Greg
Greg:
1. The options argument is set to nil. Also, you can download the full source code for any screencast using the link in the Resources section.
2. Hrm, are you sure your ProductTableCell is a subclass of UITableViewCell? Perhaps it's not recognizing it as a valid outlet.
3. I'm not planning to charge for these screencasts. Is there a specific reason you're asking about paid content?
Thanks,
Mike
Mike,
Thanks for the response. I missed the code link.
I asked about paid content because your screencasts are great and I thought maybe the iphone dev ones might be the start of a more complete class. You do a great job.
Thanks,
Greg
I implemented the didSelectCell method, but when the view appears, none of the labels update. I created a DetailViewController with 3 labels (just like the cell), and I have a configureFromProduct method that's nearly identical to the cell's method.
The labels never update though and I can't figure out why. Any ideas?
James
Thank you very much. I've been struggling with some very complex forms in UITableViews, and between this (which I never really "got" before) and Matthew Gallagher's GenericTableView method of refactoring Table Views, my code bloat has dropped significantly. One note for future viewers of the screencast... if you plan to use this technique in a grouped style table, the UIView that you place in the background must have its background color set to clear and its opaque property turned to false for the grouped style cell to show properly. Threw me for a little while.
Hi. Great tutorial! But when I tried running it with the Instruments checking for leaks, it said it was leaking. I'm not an expert in Instruments so I'm not sure is something that is autoreleased still shows up as leaks--so maybe that's the case. Anyway, I'm just wondering if you checked this "Custom Table Cells in Interface Builder" project with Instruments and confirmed there are no leaks? Anyway, thanks mucho--and I bought your XCode screencast by the way.
Hi Mike!
Thanks for the great tutorials!
I've got a question.
You talked about decoupling -- a great thing for keeping the code clean. I wondered, why you hardcoded the specific row-height into the app instead of letting it depend on the height of the cell in the nib.
Do you have a reason for that?
Don't get me wrong - I don't plan to critisize you; I just wanna know ;-)
Regards,
Florian
Great tutorial. How do i make each row clickable to their own detail view?
Thanks. I created a tab bar application from O'Reilly's tutorial; and trying to get this table view to work in one of the tabs. The problem is that there are now two view controllers that are redundant. How would you go about integrating these two methods? Or alternatively how would you put this in a tab?
Thanks.
Does anyone read these comments (other than the people making the comments/asking the questions)?
re: my tab bar app; I fixed it by using the correct controller ;)
Now, to store the data elsewhere...
Hello,
I am a newbie and I have a doubt on how I would have access to a didSelectRowAtIndex. Where would I need to include it and will it need a special implementation?
thanks
ldj
First time on your site and I am thoroughly impressed with this video. Thanks a lot! Definitely will be watching your other screencasts.
Great tutorial!
How do I add this to an existing view controller (such as the one instructed by O'Reilly), though?
I'm getting all sorts of errors over here. I just need to implement the custom view to an existing table...
Thanks!

