Here is the code:
CGRect myImageRect = CGRectMake(0, 0, 100, 100);
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[myImage setImage:[UIImage imageNamed:@"Angry0.png"]];
[mainView addSubview:myImage];
Angry0.png is in my Resources folder. No image is display on simulator.
Right… You need to initalize all your views…
If I’m right your view hierarchy is this:
So somewhere when you load mainView you also need to initalize all the child views…
For example:
Now, providing that you correctly set your views frames and initialized them they shouldn’t be null…
You can check by calling:
Then you should be able to call your existing code and all should be good