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