Reputation: 3912
Here is my code that does not work. I tried first to load the image from file, now I am using a named image:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
UIImage *imageYouWantToPass = [UIImage imageNamed:@"bl_5_00"];
self.mainImage.image = imageYouWantToPass;
}
If I put an image in the Images.xcassets folder should the above code work? In other words, if the image is not showing, it is due to a mistake elsewhere in my code?
Upvotes: 5
Views: 6502
Reputation: 776
That image should work if you have a group in 'Images.xcassets'. It's case sensitive too so beware. If you just drag and drop the images into the folder, that could be a problem. Click on the .xcassets file in XCode, create a new Image Set and put the image in the boxes.
Upvotes: 3