简体   繁体   中英

Views in iOS7 moved above Navigation bar but work fine in iOS6

I am unable to get the UISearchBar to display fine on iOS7. I cannot use AutoLayout as I must support the app for older versions of iOS prior to 6 also. I tried setting the container view's frame if the iOS is of version 7 and above but it does not work. I also tried topLayOutGuide length and other tips mentioned in other SO posts but I could not succeed. (EDIT:- I am using STORYBOARD)

The only thing I currently have in my code is

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
    self.edgesForExtendedLayout = UIRectEdgeNone;
}

Can someone please help me with this issue?

iOS7中模拟器顶部的屏幕截图iOS6中模拟器顶部的屏幕截图

I try to suggest a change to do in the storyboard :

tap on your viewController and on attributes inspector uncheck Under top bars

在此处输入图片说明

if this not work try this code:

-(void)viewWillAppear:(BOOL)animated {

 NSString *ver = [[UIDevice currentDevice] systemVersion];
 int ver_int = [ver intValue];

 if (ver_int < 7) {
 }
 else {
     self.navigationController.navigationBar.translucent = NO;
 }

}

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