gpt4 book ai didi

ios6 - 使用状态栏在 Xcode 4.5 iOS 6.0 中更改为横向

转载 作者:行者123 更新时间:2023-12-02 03:55:40 24 4
gpt4 key购买 nike

我一直在为我的 iOS 项目使用 Xcode 4.4,我希望我的其中一个屏幕是永久横向的,所以我使用了

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

它工作得很好,但自从我更新到 Xcode 4.5 和 iOS 6.0 后它根本不起作用,所以我发现我必须使用新功能,现在我有:

- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeRight;
}

- (BOOL)shouldAutorotate {
return YES;
}

所以现在我的屏幕是横向的,但状态栏保留在原位,就像屏幕仍处于纵向模式一样。

我不知道怎么解决。

谢谢。

最佳答案

我将它实现到 viewWillAppear 函数中,它在 iOS6 中有效:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:YES];

关于ios6 - 使用状态栏在 Xcode 4.5 iOS 6.0 中更改为横向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12799729/

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