0
我有4个xib,其中两个xib用于ios7,另一个用于ios6.i没有使用autolayout,我的应用在3.5和4英寸的ios 7上运行良好,但问题发生在我运行应用程序在ios6.i区分代码,因为那里ios verion。ios 6和ios 7 Gui问题
当应用程序开始其导航栏是在一些底部,如果我点击另一个选项卡,并再次返回两个我的第一个标签导航栏是完美的side.i静态导航栏。
这里是我的一个视图控制器代码被点击
NSLog(@"Iphone %f ",\[\[UIScreen mainScreen\] bounds\].size.height);
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
//The version of the device is iOS7.0 or higher.
if (IS_IPHONE_5) {
_HomeViewController_obj = \[\[_HomeViewController alloc\] initWithNibName:@"4HomeViewController" bundle:nil\];
} else {
_HomeViewController_obj = \[\[_HomeViewController alloc\] initWithNibName:@"4HomeViewController_iphone4" bundle:nil\];
}
//call controller with ios7 xib here
}
else
{
//The version of the device is lower then iOS7.0.
if (IS_IPHONE_5) {
_HomeViewController_obj = \[\[_HomeViewController alloc\] initWithNibName:@"4HomeViewController_iphone5" bundle:nil\];
} else {
_HomeViewController_obj = \[\[_HomeViewController alloc\] initWithNibName:@"4HomeViewController_iphoneOld" bundle:nil\];
}
//call controller with ios6 xib here
}
if(\[UIDevice currentDevice\].userInterfaceIdiom == UIUserInterfaceIdiomPad)
{
NSLog(@"Ipad ");
}
else
{
NSLog(@"Iphone %f ",\[\[UIScreen mainScreen\] bounds\].size.height);
if (\[\[UIScreen mainScreen\] bounds\].size.height == 568) {
\[btn1 setFrame:CGRectMake(15, 525, 30, 40)\];
\[btn2 setFrame:CGRectMake(80, 525, 30, 40)\];
\[btn3 setFrame:CGRectMake(140, 525, 30, 40)\];
\[btn4 setFrame:CGRectMake(205, 522, 45, 45)\];
\[btn5 setFrame:CGRectMake(275, 525, 30, 40)\];
} else {
\[self.view setFrame:CGRectMake(0,0, 320, 480)\];
\[btn1 setFrame:CGRectMake(15, 436,40, 40)\];
\[btn2 setFrame:CGRectMake(76, 436,40, 40)\];
\[btn3 setFrame:CGRectMake(140, 436,40, 40)\];
\[btn4 setFrame:CGRectMake(200, 436,40, 40)\];
\[btn5 setFrame:CGRectMake(260, 436,40, 40)\];
// this is iphone 4 xib
}
}![enter image description here][3]
为什么,为什么面临这样的问题 – codercat
代码我没有使用自动布局和故事板这就是你的屏幕截图 –
IM搭起自己搞砸了多个设备屏幕 – codercat