在iPad上的纵向模式的工具栏停留在相同的位置,在横向模式下

问题描述:

我有一个工具栏,我无法找到在屏幕的底部,这...在iPad上的纵向模式的工具栏停留在相同的位置,在横向模式下

toolbar = [[UIToolbar alloc] init]; 

[toolbar sizeToFit]; 

CGFloat toolbarHeight = [toolbar frame].size.height; 
CGRect rootViewBounds = self.view.bounds; 
CGFloat rootViewHeight = CGRectGetHeight(rootViewBounds); 
CGFloat rootViewWidth = CGRectGetWidth(rootViewBounds); 
CGRect rectArea = CGRectMake(0, rootViewHeight - toolbarHeight,rootViewWidth, toolbarHeight); 

[toolbar setFrame:rectArea]; 

    [toolbar sizeToFit]; 

[self.view addSubview:toolbar]; 

...应用程序被启动,一切正常,但是当我打开iPad并将设备的方向更改为纵向时,我的工具栏保持较高,而不是视图的底部。

你应该在笔尖使用自动布局

+0

我不能使用“自动布局”。否则,我会用另一种观点来解决问题。 – user922907