0
我有一個工具欄,我無法找到在屏幕的底部,這...在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並將設備的方向更改爲縱向時,我的工具欄保持較高,而不是視圖的底部。
我不能使用「自動佈局」。否則,我會用另一種觀點來解決問題。 – user922907