Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
无论如何,当设备旋转时,自定义 UIToolbar 的 UIBarMetrics 是否会发生变化?我希望它自动发生,但如果在轮换期间我可以做些什么也可以。我想使用 UIAppearance 所以手动调整栏的高度是行不通的。
我想你需要
UIToolbar *toolbar = [UIToolbar 外观]; [工具栏 setBackgroundImage:[UIImage imageNamed:@"toolbarLandscapePhone"] forToolbarPosition:UIToolbarPositionBottom barMetrics:UIBarMetricsLandscapePhone];
UIToolbar *toolbar = [UIToolbar 外观];
[工具栏 setBackgroundImage:[UIImage imageNamed:@"toolbarLandscapePhone"] forToolbarPosition:UIToolbarPositionBottom barMetrics:UIBarMetricsLandscapePhone];
您可以简单地将 BarMetrics 设置为 UIBarMetricsLandscapePhone