【问题标题】:how to disable portrait mode for the components when device rotates in Objective C当设备在Objective C中旋转时如何禁用组件的纵向模式
【发布时间】:2016-08-03 07:56:37
【问题描述】:

我有一个背景图片,可以全屏显示。

这段代码创建了视图:

UIImageView *backgroundView=[[UIImageView alloc]initWithFrame:self.view.bounds];
backgroundView.image=[UIImage imageNamed:@"fullscreen.jpg"];

当我将手机旋转到横向时,它的尺寸会发生变化。那么如何禁用视图的横向旋转,以便任何旋转它的框架都不会改变。

有问题的观点:

【问题讨论】:

  • 您希望为此实例或整个应用程序停止轮换。对于常规取消选择横向下的整个应用程序

标签: objective-c ios8 xcode7


【解决方案1】:

让我们看看项目的一般属性 -> 部署信息(复选框“横向左侧”和“横向右侧”)。我希望这会有所帮助。

以编程方式: 您可以覆盖方法“supportedInterfaceOrientations” 像这样:

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;

}

【讨论】:

  • 谢谢你的作品。你能建议我一种程序化的方式吗?
猜你喜欢
  • 1970-01-01
  • 2016-06-12
  • 1970-01-01
  • 2016-11-17
  • 2021-12-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多