Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-12-2008, 10:37 PM   #1 (permalink)
skinrock
Registered Member
 
Join Date: Aug 2008
Posts: 177
Default Custom UITableViewCell

I have a view xib that contains just a UITableView, which loads fine, I have it listing out data from my database. But I want to use a custom UITableViewCell, so I added one to the same xib. The reason is so that I can design it in Interface Builder instead of trying to code it.

I changed the class of the ListViewCell to a class I created that extends UITableViewCell. I've tried two ways of allocating this class in the cellForRowAtIndexPath method. First I tried:

Code:
cell = [[[ListViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
But that doesn't seem to use the design from within Interface Builder.

I then tried setting an IBOutlet on my UITableViewController class, and linked it to the TableViewCell using IB, and then this line:

Code:
cell = [[listViewCell initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
But as you might imagine, it doesn't properly create a new ViewCell for each row, it gets messed up: the first two become blank and only the last row actually has a design to it.
skinrock is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,688
Threads: 89,160
Posts: 380,406
Top Poster: BrianSlick (7,110)
Welcome to our newest member, mary3chil
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:20 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.