0

I've got a custom cell with a UILabel and UIImageView which is only partly working.

The storyboard is connected to each of the outlets and all that... no problems there. In the view controller the label is being populated with the text fine... but for whatever reason, the image is not showing up.

CustomCell.h

 @property (strong, nonatomic) IBOutlet UILabel *lblMenuItem;
 @property (strong, nonatomic) IBOutlet UIImageView *imgMenuItem;

MainViewController.m

 CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
 cell.lblMenuItem.text = menuTitleArrat[indexPath.row];
 cell.imgMenuItem.image = [UIImage imageNamed:imageMenuArr[indexPath.row]];

The text is showing up in the label for the custom cell, but the image... nothing. No warnings, just nothing showing up.

Now, if I add the image like so:

 cell.imageView.image = [UIImage imageNamed:imageMenuArr[indexPath.row]];

That works, but the positioning is off from how it's set in the storyboard the way I'd like.

Thoughts / comments? Seems like this shouldn't be that difficult...




EDIT: Good points, but unfortunately not that either.

Here's the setup in the storyboard:

storyboard setup

And then it running in the simulator:

Running in the simulator

Drew
  • 1,422
  • 1
  • 18
  • 29
  • check the image view position and size, it might be out of displayed bounds. – A-Live Apr 07 '14 at 17:57
  • Also check if the label overlaps your image. You can change background colors to do that. – Marcal Apr 07 '14 at 18:00
  • what you show here should work, try setting the image in XCode directly just to test that everything hooked up correctly – meda Apr 07 '14 at 21:41
  • I'd recommend to use Debug Hierarchy Tools of XCode: https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/debugging_with_xcode/chapters/special_debugging_workflows.html#//apple_ref/doc/uid/TP40015022-CH9-SW2 – Larme Aug 05 '16 at 15:13

0 Answers0