为了账号安全,请及时绑定邮箱和手机立即绑定

试过了下面两个方法都无效,请问该怎么办?

试过了下面两个方法都无效,请问该怎么办?

iOS
阿晨1998 2023-04-18 14:10:11
ipad 应用 锁定lanscape状态不变,无论怎么旋转,如何实现- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation  {  return UIInterfaceOrientationIsLandscape(interfaceOrientation); }还有(BOOL)shouldAutorotateToInterfaceOrientation:UIInterfaceOrientation)interfaceOrientation  {  return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); }我用的是ios6

1 回答

?
PIPIONE

TA贡献1829条经验 获得超9个赞

如果整个程序都要横屏,plist中修改下最省事。

	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationLandscapeLeft</string>
	</array>

或者代码中viewcontroller加,

- (BOOL)shouldAutorotate
{    return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{    return UIInterfaceOrientationMaskLandscapeRight;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{    return UIInterfaceOrientationLandscapeRight;
}

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


查看完整回答
反对 回复 2023-04-20

添加回答

代码语言

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号