简体   繁体   中英

UIView Issues in Iphone 4 and Iphone 5

I'm having problems with the layout on the iphone 4 and iphone 5. Actually the iphone 4, everything works, the problem is the iphone 5. The issue in iPhone5 is where have the green circle. The login page, it lost some parts of box inside navigation bar and the back button not show, in the list page not show background image and the title is black!

Follows pictures:

iPhone 4 - iOS 5.1.1

iPhone 4  - 登录即可红色查看表是可以的

iPhone 5 - iOS 7.0.3

登录背景由导航栏决定红色查看表不显示

Here is how i set the background image to view up the table:

UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
self.viewUp.backgroundColor = background;

And here how i set the back button with Appearance proxy in my appDelegate

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];

UIImage *backButtonHomeImage = [[UIImage imageNamed:@"navegacao_botao_voltar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonHomeImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];

The problem is related with the iOS version, no with the phone size.

In iOS7, your views are by default extended to fill the whole screen, so on your view controller you have to do:

self.edgesForExtendedLayout = UIRectEdgeNone;

To cancel that effect.

You can find the explanation and more info here:

Explaining difference between automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars, edgesForExtendedLayout in iOS7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM