Making a custom tableviewcell [Fixed]


#1

Hi, when going for the challenge to display more data under the table, I took to create just my own cell. Reading through the Apple documentation “A Closer Look at UITableView” I think it was called, I tried following the steps for just making a new cell from a nib file. After some work, I got it to load those cells, but the font in them is extremely small.
If anyone could help shed light on this, it would be appreciated. Thanks!
Xcode 4.2.1
iOS iPad simulator 5.0

Interestingly enough, after reviewing the preview of this post, I noticed that the fonts actually slightly increase in size with every row. I’m dumbfounded.

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DetailCell"]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"Cell" owner:self options:nil]; cell = tvc; self.tvc = nil; } RSSItem *item = [[channel items] objectAtIndex:[indexPath row]]; UILabel *label = (UILabel*)[cell viewWithTag:1]; label.text = [item title]; label = (UILabel*)[cell viewWithTag:2]; label.text = [item author]; label = (UILabel*)[cell viewWithTag:3]; label.text = [item category]; return cell; }


#2

I fixed the issue. Implemented (float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
with the height from the nib file. I then changed the autoresizing springs and bars for the labels to get the text to fit quite well.