Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

duny

macrumors newbie
Original poster
I am trying to list a bio of myself (testing purposes) on my app. No matter what it always truncates the text. how can i list this all or create a box big enough to house all the text.

Below is my code for the table.

Code:
- (NSInteger)tableView:(UITableView *)tblView numberOfRowsInSection:(NSInteger)section {
    return 1;
}


- (UITableViewCell *)tableView:(UITableView *)tblView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }
	
	switch(indexPath.section) {
		case 0:
	        cell.image = [UIImage imageNamed:(NSString *)rankObj.RankImage];
			break;
		case 1:
			cell.text = rankObj.RankName;
			break;
		case 2:
			cell.text = rankObj.RankNum;
			break;
		case 3:
			cell.text = rankObj.RankShort;
			break;
	}
	
	return cell;
}

- (NSString *)tableView:(UITableView *)tblView titleForHeaderInSection:(NSInteger)section {
	
	NSString *sectionName = nil;
	
	switch (section) {
		case 0:
			sectionName = [NSString stringWithFormat:@"Image"];
			break;
		case 1:
			sectionName = [NSString stringWithFormat:@"Name"];
			break;
		case 2:
			sectionName = [NSString stringWithFormat:@"Rate"];
			break;
		case 3:
			sectionName = [NSString stringWithFormat:@"Abbreviation"];
			break;
	}
	
	return sectionName;
}
 

Attachments

  • Snapshot 2009-03-26 19-24-00.jpg
    Snapshot 2009-03-26 19-24-00.jpg
    23.8 KB · Views: 120
I don't think that is germane to the problem here. To make the text multiline you need to make a custom cell or insert a UITextView into the cell. Alternatively you need to resize the text to fit the single line you have.
 
UILabel is capable of multi-line text, through the numberOfLines property. I'd look into using that.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.