Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-12-2008, 09:37 PM   #1 (permalink)
skinrock
Registered Member
 
Join Date: Aug 2008
Posts: 158
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
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,144
Threads: 38,921
Posts: 170,764
Top Poster: smasher (2,565)
Welcome to our newest member, HovRay567
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:01 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.