UITableViewCell
Jonathan Wad...
3 posts
|
Hi, I’m finding the book very helpfull and it’s clearing up many of my misunderstandings. Please, can we have more on customising UITableViewCell? The apple documentation hasn’t really helped me understand the best ways to tailor:
It appears that many applications will probably need to tailor the way table cells are formatted. Many thanks |
Joseph Barkley
3 posts
|
I second that request. |
Greg de Vitry
1 post
|
I found the Apple SeismicXML tutorial showed how to use a custom Cell. http://developer.apple.com/iphone/library/samplecode/SeismicXML/index.html (good for an XML download tutorial too). In the table creation, you use TableViewCell *cell = (TableViewCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier]; The ‘TableViewCell.m’ file contains the drawing of the cell. To auto change the height of a text field, you need to determine the orientation of the phone/touch.
|
Roman Busyghin
21 posts
|
Also, you can design UITableViewCell using Interface Builder, attach IBOutlet to it and return this cell from |
Bill Dudney
653 posts
|
Hi All, Roman’s suggestion is great except that you need to load the nib file over and over. The TV expects a new TVCell for each new visible cell so you need to use the dequeue method to get a repeated cell. Chris is working on getting this technique into the table view chapter. Look for it soon in an upcoming beta. Thanks again! |
Timothy Schmitz
1 post
|
Really looking forward to this update to the table view chapter. I’ve experimented with loading UITableViewCells from IB, and run into a few problems. Keep up the great work, guys! |
Adam Venturella
4 posts
|
I agree, It took me FOREVER to discover that I needed to make a new XIB that was a UITableViewCell, and set an IBOutelt and load the resource so it bound to the IBOutlet. It would be good to have something that covers this process, as it’s really not documented anywhere. I also remember listening to Late Night Cocoa #33 and, I forget which of the 3 authors it was, mentioned something to the effect of the proper way to do custom TableViewCells. The conversation never touched on it again. In fact, I bought the beta book for that sole reason, to see if the explained what that meant or if the IBOutlet thing was the way to go. In any case, I think it would be a good sub chapter to add to the book. =) |
Chris Adamson
153 posts
|
Like Bill said, I’m going to add this to the table chapter in an upcoming errata sweep. But actually, I already did sort of sneak this into the book, at least its sample code, via the backdoor. Look in the database chapter at Figure 8.2. Notice that the table cells have three labels, laid out with different sizes, colors, and positions. And nobody’s posted an HTF? Here’s the summary of the approach I’m generally using:
I’ve now done this in a few apps of my own, and my technique is a little refined from what you see in the database example. That code, at least in the version that’s checked in, doesn’t use the identifier (wrong!), and uses a singleton for the factory instead of just using a class method. I also want to take a little more time to try to find a “deep clone” method that I could use for generating new cells within the factory instead of reloading the NIB every time. I’ll be working through these issues soon before touching the table chapter. But if you’re keen to get unblocked, there you go… |
8 posts, 8 voices
