Problem:
In Appdelegate
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {
Viewcontroller *vc=[[viewcontroller Alloc]init];
Uinavigationcontroller *nav=[[uinavigationcontroller ALLOC]INITWITHROOTVIEWCONTROLLER:VC];
Nav.view.backgroundColor = [Uicolor Bluecolor];
Self.window.rootviewcontroller=nav;
return YES;
}
In the Viewcontroller:
-(void) viewdidload {[Super viewdidload];//if ([Self respondstoselector: @selector (setedgesforextendedlayout:)])// {//Self.edgesforextendedlayout = uirectedgenone;//}//Self.navigationController.navigationBar.translucen T=no; Self.view.backgroundcolor=[uicolor Clearcolor]; Uiscrollview *segmentscorllview = [[Uiscrollview alloc] Initwithframe:cgrectmake (0, 164, Self.view.frame.size.width, 44)]; Segmentscorllview.backgroundcolor=[uicolor Greencolor]; UIButton *button = [UIButton buttonwithtype:uibuttontypecustom]; [Button setframe:cgrectmake (0, 0, 50, 44)]; [Button settitle:@ "AAA" forstate:uicontrolstatenormal]; [Button Settitlecolor:[uicolor Bluecolor] forstate:uicontrolstateselected]; [Button Settitlecolor:[uicolor Redcolor] forstate:uicontrolstatenormal]; Button.backgroundcolor = [Uicolor Browncolor]; [Button.titlelabel Setfont:[uifont systemfontofsize:15]; [Segmentscorllview Addsubview:button]; [Self.view addsubview:segmentScorllview];}
Operating effect:
Ideal running Result:
Reason:
The starting coordinates of the screen in IOS7 include the navigation status bar
Workaround:
Remove any comment from the two comments of the above code
IOS7 Navigation bar Adaptation