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 06-07-2009, 11:23 PM   #1 (permalink)
wickersty
New Member
 
Join Date: Jun 2009
Posts: 16
Default auto expanding multiline table cells

Hi all,

I've been working on trying to get multiline auto expanding (expand to fit, or at least expand to fit a few lines) for a while and am having no luck, other than a really awful method of dynamically placing labels inside of cells which I don't like (and I can't believe that's the "correct" way to do it. Would anyone who'se figured this out care to shed some light and advice?

I'm pasting the a screenshot of what I've got so far (note the third cell is cut off and not multiline) as well as the code I've been using below.

I appreciate all of your wisdom and advice

Jeff

Code:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
	return [programDetails count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:nil] autorelease];
		
	if (indexPath.row == 0) { // program name
		cell.font = [UIFont boldSystemFontOfSize: 12];
	} else if (indexPath.row == 1) { // program tagline
		cell.font = [UIFont systemFontOfSize: 12];
	} else { // program description
		cell.font = [UIFont systemFontOfSize: 10];
	}
	
	cell.text = [programDetails objectAtIndex:indexPath.row];
	
	return cell;
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	[super viewDidLoad];
	
	self.tableView.rowHeight = 50;
	
	programDetails = [[NSMutableArray alloc] init];
	
	[self loadProgramData];
}
Attached Images
File Type: png Picture 1.png (13.4 KB, 10 views)
wickersty is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,842
Threads: 89,211
Posts: 380,652
Top Poster: BrianSlick (7,129)
Welcome to our newest member, immortalkenny
Powered by vBadvanced CMPS v3.1.0

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