9

How to Configure the Viewcontroller Background Image on iOS6 in a 4-inch Screen

 3 years ago
source link: https://www.codesd.com/item/how-to-configure-the-viewcontroller-background-image-on-ios6-in-a-4-inch-screen.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to Configure the Viewcontroller Background Image on iOS6 in a 4-inch Screen

advertisements

I need one clarification i have image size 640×1136 it is set view controller background full view this is set fine in iOS 7 because the status bar merge with view.

 self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"iOS-7.png"]];

cVlyb.png

but in iOS 6 i can’t set the size of 640×1136 this image bottom size is hide. how to handle image on view controller background in iOS 6

T6oki.png

How can i resolve the issue

   UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
    imageView.contentMode = UIViewContentModeScaleToFill;
    [imageView setImage:[UIImage imageNamed:@"iOS-7.png"]];
   // self.view.backgroundColor = [UIColor colorWithPatternImage:imageView.image];

    [self.view addSubview:imageView];

if i used this above code only worked fine. thanks for answer @Greg but i need to know why screen issues occurs on set self.view backgroundColor


So, iOS 7 switched the status bar to be translucent by default, and to allow content views to appear behind it. This is not the default for iOS 6. Hence, you're seeing your normal views start just below the status bar, and as you (weren't) scaling the view correctly, it was clipped.

You can get a similar effect for iOS 6 and below. Set the status bar to be translucent:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];

and then, for each view controller you have, set:

myViewController.wantsFullScreenLayout = YES;

This should cause your views to extend below a translucent status bar, similar in style to iOS 7.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK