I'm having a few issues with displaying a UIImage in an app that I'm developing. The steps I took to do this are as follows:
1 - Add a UIImageView to my main view controller in the storyboard. I did this using the interface builder.
2 - I then created an IBOutlet for the UIImageView in the viewcontroller.h. I ensured proper referencing of the image view from the outlet.
3 - I set the image for the UIImageView like so:
_fireIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"flame_icon.png"]];
This was done within the viewDidLoad method in the viewcontroller.m file.
Troubleshooting:
Let me know if you need any more additional information, or code snippets.
you need not to initialize an imageview as you are using Interface builder for image view
_fireIcon.image = [UIImage imageNamed:@"flame_icon.png"]; // or [_fireIcon setImage:[UIImage imageNamed:@"flame_icon.png"]];
This sets the image. When we drop the UI elements using Interface builder , we need not initialize them, as they are taken care by apple.