2015-06-09 77 views
0

我在xib文件中添加了工具栏。但它不能在ios6模拟器中正确显示。它在ios4模拟器中显示出完美。Ios ::工具栏对齐问题

以下是截图。

iphone 6图像

iphone6 image

iPhone4S的图像

iphone 4s iamge

请看幻灯片留在图像删除工具栏,这是很好的iPhone 4S,但之间的进来在iPhone 6模拟器中。

请帮忙解决这个问题...

回答

0

下面的代码固定所有模拟器我的问题。

//Caclulate the height of the toolbar 
CGFloat toolbarHeight = [toolbar frame].size.height; 

//Get the bounds of the parent view 
CGRect rootViewBounds = [UIScreen mainScreen].bounds; 

//Get the height of the parent view. 
CGFloat rootViewHeight = CGRectGetHeight(rootViewBounds); 

//Get the width of the parent view, 
CGFloat rootViewWidth = CGRectGetWidth(rootViewBounds); 

//Create a rectangle for the toolbar 
CGRect rectArea = CGRectMake(0, rootViewHeight - toolbarHeight, rootViewWidth, toolbarHeight); 
self.toolbar.frame = rectArea; 

我已经把上面的代码放在viewWillAppear方法中。