Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't view an image in table cell
    primarykey
    data
    text
    <p>guys</p> <p>I'm doing <a href="http://www.techotopia.com/index.php/Using_Xcode_Storyboards_to_Build_Dynamic_TableViews_with_Prototype_Table_View_Cells" rel="nofollow">this</a> tutorial but after writing the code I can't see any images in the table cells -> they're white!</p> <p>I added the picture files in the Supporting Files folder, read the tutorial one more time, but can't solve this problem! Please, can anyone help me with this?</p> <pre><code>@interface CarTableViewController () @end @implementation CarTableViewController @synthesize carMakes = _carMakes; @synthesize carImages = _carImages; @synthesize carModels = _carModels; - (id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.carMakes = [[NSArray alloc] initWithObjects:@"Chevy", @"BMW", @"Toyota", @"Volvo", @"Smart", nil]; self.carModels = [[NSArray alloc] initWithObjects:@"Volt", @"Mini", @"Venza", @"S60", @"Fortwo", nil]; self.carImages = [[NSArray alloc] initWithObjects:@"chevy_volt.jpg", @"mini_clubman.jpg", @"toyota_venza.jpg", @"volvo_s60.jpg", @"smart_fortwo.jpg", nil]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.carModels count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"carTableCell"; CarTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[CarTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } cell.makeLabel.text = [self.carMakes objectAtIndex:[indexPath row]]; cell.modelLabel.text = [self.carModels objectAtIndex:[indexPath row]]; UIImage *carPhoto = [UIImage imageNamed:[self.carImages objectAtIndex: [indexPath row]]]; cell.carImage.image = carPhoto; return cell; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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