Reputation: 277
Here in my app i used the background image size as 320 x 480,but in the end of the screen some portions not visible,here my code
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"ibg.png"]];
Please help me to solve to make the image screen fit..
Upvotes: 2
Views: 771
Reputation: 653
If the invisible portion has height equal to 50 pixel, then could you please try resize your image (ibg.png) to 320 x 430 using
- (UIImage *)imageWithImage:(UIImage *)image convertToSize:(CGSize)size {
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *destImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return destImage;
}
after that
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"ibg.png"]];
should make it, hope it help, please give me a feedback, thanks.
Upvotes: 2
Reputation: 3853
Your image may be offset by the status bar, which takes up 20 pixels (or 'points') of space at the top of the screen. If your status bar is visible, the Y position of your full-screen background image must be -20 rather than 0.
Upvotes: 0