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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With