gpt4 book ai didi

ios - 在 iPad 的纵向模式下,工具栏与横向模式保持相同的位置

转载 作者:行者123 更新时间:2023-11-29 03:16:37 25 4
gpt4 key购买 nike

我有一个工具栏,但我无法在屏幕底部找到它......

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 并将设备的方向更改为纵向时,我的工具栏保持在较高位置,而不是在 View 的底部。

最佳答案

你应该在你的 nib 中使用自动布局

关于ios - 在 iPad 的纵向模式下,工具栏与横向模式保持相同的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21613807/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com