标签: uiinterfaceorientation

iPad启动方向

在我的信息plist中,我将支持的界面方向(iPad)定义为所有方向,并且它可以工作.唯一的问题是,如果我以横向模式启动,它将以肖像方式启动,但如果我旋转然后向后旋转,则会修复.那么我怎样才能使它适应启动方向呢?谢谢.

cocoa-touch objective-c ipad uiinterfaceorientation ios

3
推荐指数
1
解决办法
2791
查看次数

iPhone - 屏幕旋转?

UIDeviceOrientation&之间有什么区别UIInterfaceOrientation

我应该使用哪一个来检测UIView上的旋转?

iphone uiinterfaceorientation ios uideviceorientation

3
推荐指数
1
解决办法
3552
查看次数

如何在方向改变时管理应用程序?

我有一个应用程序,我正在改变屏幕方向.但是当我更改第一个屏幕的方向并转到下一个屏幕时,更改不会持续存在.

随附图像以便更清楚地理解.

纵向模式下的第一个视图屏幕 横向模式下的第一个视图屏幕

横向模式下的第二个视图屏幕 纵向模式下的第二个视图屏幕


主要问题是当设备旋转时,第一个屏幕旋转但第二个屏幕没有以新方向启动.
只有在屏幕启动后我们改变方向时它才会旋转.

我该如何解决这个问题?

iphone uiinterfaceorientation

3
推荐指数
1
解决办法
930
查看次数

方法[UIDevice setOrientation:] - 它仍被拒绝吗?

我听说使用[UIDevice setOrientation:]可能是Appstore拒绝应用的原因.有没有关于它的证明信息?

uiinterfaceorientation ios

3
推荐指数
1
解决办法
5579
查看次数

iOS:在plist中忽略初始界面方向[UIInterfaceOrientation]

我正在尝试将我的应用的初始方向设置为UIInterfaceOrientationLandscapeLeft

我不能

'Initial interface orientation'[UIInterfaceOrientation]
Run Code Online (Sandbox Code Playgroud)

覆盖数组中的第一项

'Supported interface orientations'[UISupportedInterfaceOrientations]
Run Code Online (Sandbox Code Playgroud)

我注意到一个iphone应用总是以'Portrait(底部主页按钮)'开头.数组是:

'Supported interface orientations'[UISupportedInterfaceOrientations]

Portrait (bottom home button)

Landscape (left home button)

Landscape (right home button)
Run Code Online (Sandbox Code Playgroud)

这是预期的.

如果我在摘要页面上关闭PORTRAIT HOME BOTTOM按钮OFF THEN BACK ON然后数组的顺序改变而Portrait(底部主页按钮)移动到底部.

Landscape (left home button)

Landscape (right home button)

Portrait (bottom home button)
Run Code Online (Sandbox Code Playgroud)

当我运行应用程序时,它现在从横向(左主页按钮)开始,因为它现在是列表的顶部.哪个好

当我添加

'Initial interface orientation'[UIInterfaceOrientation]
Run Code Online (Sandbox Code Playgroud)

并将其设置为

Landscape (right home button)
Run Code Online (Sandbox Code Playgroud)

它被忽略,而数组中的第一项则被使用

Landscape (left home button)
Run Code Online (Sandbox Code Playgroud)

我检查了shouldAutorotateToInterfaceOrientation,它只阻止了肖像颠倒

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != …
Run Code Online (Sandbox Code Playgroud)

iphone uiinterfaceorientation device-orientation ios

3
推荐指数
1
解决办法
5478
查看次数

iPad app landscape启动带有纵向尺寸的根视图控制器

我已经设置了一个新的iPad项目,只支持UIInterfaceOrientationLandscapeRight.

在我的App Delegate中,我将一个RootViewController添加到窗口的rootViewController中.

在这个UIViewController(RootViewController)中,我有以下内容:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

但是,当我根据视图控制器视图的尺寸创建和添加子视图时,我无法获得应用程序的正确尺寸.

如果我为我的视图控制器输出self.view.frame {{0, 0}, {768, 1024}},我会得到{1024,768}.如果我不能在什么时候尺寸正确,那么我可以用它们来创建我的观点?

对不起,如果这被问了十亿次,我浏览了很多SO问题,但没有解决我的问题.

ipad uiinterfaceorientation ios

3
推荐指数
1
解决办法
2231
查看次数

视图控制器之间的转换和iOS中的旋转

考虑一个带有两个子视图控制器(A和B)的容器视图控制器,两者都添加了addChildViewController:.然后:

  1. A.view 被添加到容器视图中
  2. B transitionFromViewController从A到B显示.B接收viewWillLayoutSubviews并且全世界都很好.
  3. 设备在显示B时旋转.只有B接收旋转调用(willRotateToInterfaceOrientation:全部).
  4. transitionFromViewController从B到A 显示A.A不接收viewWillLayoutSubviews,因此布局被破坏.

这是预期的行为吗?如果没有,我可能做错了什么?如果是,我应该怎么做才能在显示B时通知A旋转变化?

iphone uiviewcontroller uiinterfaceorientation ios ios5

3
推荐指数
1
解决办法
3381
查看次数

应用程序始终在Landscape Left中启动

在我的应用程序中,支持的方向是Landscape Right和Landscape Left.它的单屏应用程序.在ViewController中,我添加了以下代码来限制方向.

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

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

-(BOOL)shouldAutorotate
{
    return YES;
} 
Run Code Online (Sandbox Code Playgroud)

我的问题是每当应用程序在Landscape Left中启动时.如果设备位置右侧,则应用视图旋转180度,然后应用程序开始在右侧右侧工作.

如果设备位置是横向左侧,则没有问题.

注意:我正在测试iPod 5上的应用程序.

编辑:

经过一些观察,如果你只支持风景(即风景右侧和风景左),那么你将面临这个问题.应用程序将始终以plist中首先列出的方向打开(在我的情况下是Landscape Left).

我通过删除Landscape Left方向支持来解决此问题.如果有人有解决方案,请分享.

感谢帮助.

iphone uiinterfaceorientation ios ios7

3
推荐指数
1
解决办法
1304
查看次数

ios 8定位问题

我的应用程序,在iOS7中开发,在设备上有一个强制定位:iphone - > portrait Ipad - > landscape

使用iOS8,如果ipad上的应用程序以纵向模式启动,它将以横向显示应用程序,但结果是:

在此输入图像描述

如何修复iOS 8方向?

cocoa-touch ipad uiinterfaceorientation ios

3
推荐指数
1
解决办法
2367
查看次数

在Swift 2.0中的supportedInterfaceOrientationsForWindow

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask
{
    return UIInterfaceOrientationMask.Portrait.rawValue.hashValue | UIInterfaceOrientationMask.PortraitUpsideDown.rawValue.hashValue
}
Run Code Online (Sandbox Code Playgroud)

以前在Swift 1.2中工作但是返回行现在抛出了这个错误:

二元运算符'|' 不能应用于两个'UIInterfaceOrientationMask'操作数

我能够使用新类型只使用1个返回值,但我无法管理我需要的第二个方向.

这''有效'

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask
{
  return UIInterfaceOrientationMask.Portrait 
}
Run Code Online (Sandbox Code Playgroud)

但我认为'我需要的是这个:

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask
{
  return UIInterfaceOrientationMask.Portrait | UIInterfaceOrientationMask.PortraitUpsideDown
}
Run Code Online (Sandbox Code Playgroud)

它说的与我上面发布的错误相同.

你知道如何在Swift 2.0的AppDelegate中将方向正确设置为2个或更多值吗?

uiinterfaceorientation appdelegate swift swift2

3
推荐指数
1
解决办法
2204
查看次数