gpt4 book ai didi

iphone - 仅状态栏旋转为横向 (iPhone)

转载 作者:行者123 更新时间:2023-12-03 18:40:28 25 4
gpt4 key购买 nike

In One of my Viewcontroller that supports only Portrait orientation. On my device when rotate the status bar is rotating to landscape orientation. The rest of the view remains in Portrait mode. I want to prevent the roation of statusbar. This problem is happening only in IOS7

// Overridden function to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
// iPhone: support only upright portrait
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
else
{
// iPad: any orientation is OK
return YES;
}
}

// For iOS6.0 Rotate
- (BOOL)shouldAutorotate
{
return NO;
}

最佳答案

使用此方法将其保持在纵向 View 中:

[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;

关于iphone - 仅状态栏旋转为横向 (iPhone),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19688005/

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