I have a UIImageView that contains a pretty big image (3 +/- MB) and I am inserting it to be used as a background image as a subview like this:
- (void)viewDidLoad {
[super viewDidLoad];
[self.view insertSubview:imageView atIndex:0];
}
The problem is when the view is pushed by the navigation controller, the transition isn’t smooth; it’s very choppy because (I assume) the image is large and loading it into the image view is expensive. I used to use
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"foobar"]];
but because the image is so large, that code magnified the picture and it only shows a very small part of it, and very close up.
Is there a better/more efficient way to go about doing this?
What worked for me in the end was to create a UIImageView in MainWindow.xib and set it to the image, that way it doesn’t have to be loaded and unloaded every time the view changes, and gives the flow of the app some continuity. Thanks for your help!