Note that there are some explanatory texts on larger screens.

plurals
  1. POEmpty custom prototype cell
    text
    copied!<p>I'm new in iPhone development and have problem with prototype cell. In my storyboard, I have navigation controller. I pushed it with view controller (as main window), it has a button, when I click it I open tableView controller with custom prototype cell</p> <pre><code>- (IBAction)searchClick:(id)sender { CNCarTableController *car = [[CNCarTableController alloc]init]; [self.navigationController pushViewController:car animated:TRUE]; </code></pre> <p>}</p> <p>But when it opens it has empty rows</p> <pre><code> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: ( NSIndexPath *)indexPath { static NSString *CellIdentifier = @"TransportCell"; CNTransportCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; // Configure the cell... if(cell == nil){ cell = [[CNTransportCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } //cell.textLabel.text = @"bmv"; cell.name = (UILabel*) [cell viewWithTag:100]; [cell.name setText:@"a text"]; cell.number.text = @"number"; cell.car.text = @"car"; return cell; </code></pre> <p>}</p> <p>But if will use <code>cell.textLabel.text = @"bmv";</code> all works ok. But for custom cell way with tags or cell.lbl.text don't work. What is wrong there? Can it be a nuance of navigation controller with view controller? </p> <p>Custom cell code:</p> <pre><code> @interface CNTransportCell : UITableViewCell @property (nonatomic,weak) IBOutlet UILabel *name; @property (nonatomic,weak) IBOutlet UILabel *number; @property (nonatomic,weak) IBOutlet UILabel *car; </code></pre> <p>@end</p> <pre><code> @implementation CNTransportCell @synthesize name; @synthesize number; @synthesize car; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload