jjzjj

UIInterfaceOrientation

全部标签

ios - 在 UINavigationController Stack 中支持一个 UIViewController 横向和其他 UIViewController 纵向

我有4个UIViewControllers--命名为ControllerA、ControllerB、ControllerC、ControllerD。其中ControllerA是UINavigationStack中的RootViewController。ControllerA*ca=[[ControllerAalloc]initWithNibName:@"ControllerA"bundle:nil];UINavigationController*nv=[[UINavigationControlleralloc]initWithRootViewController:ca];self.wi

iOS 7 - Autolayout - 如何在旋转时更改 View 的位置

在这种情况下,我对使用自动布局处理UI旋转有点困惑。按钮不会改变大小或与边缘的距离,但会改变它们相对于彼此的位置。如何让这些View按照图像所示进行旋转和布局?此外,纵向View为300x300。但是,当旋转为横向时,必须将其调整为300x290以适应状态栏。我真的很想知道做到这一点的最佳方式,以及不同的方式。我已经看到了一些可能的方法,例如在设备旋转时以编程方式创建新约束,以及根据设备旋转方向加载两个单独的NIB。感谢您的帮助! 最佳答案 好的,有几种方法。第一种方法:巧妙地使用自动布局所以您知道正方形的宽度,并且它会固定在左侧和

ios - 设备界面方向

如何在应用程序启动时获取当前设备界面方向,即包含应用程序图标的主屏幕方向?例如,iPad将屏幕朝上放置(UIDeviceOrientationFaceUp),我想要获得横向界面方向(UIInterfaceOrientationLandscapeLeft)。在应用程序启动时,所有界面功能如viewController.interfaceOrientation[[uiApplicationsharedApplication]statusBarOrientation]提供错误的默认值UIInterfaceOrientationPortrait。有哪些可能的方式?

ios - 在 iOS 中处理框架的方向

是否可以允许第三方框架的两个方向?假设我在我的应用程序中使用“XYZ”第三方框架。我无权访问其源代码。该框架需要应用程序允许横向定位以实现某些功能。但是我的应用程序只支持纵向模式。所以我想只允许横向模式到“XYZ”框架。有什么办法吗?根据我的理解,为了解决这个问题,我们可以允许应用程序的两个方向,并且在每个ViewController中我们可以阻止横向方向。但是如果应用程序有20-30个ViewController,我认为这不是一个好的解决方案。 最佳答案 为了让你的一些ViewController支持多个方向,这些方向应该被允许用

ios - supportedInterfaceOrientationsForWindow 返回 UIInterfaceOrientationMaskPortrait 但我的 View Controller 显示为横向

我正在处理appdelegate.m文件中的所有方向。supportedInterfaceOrientationsForWindow为我的一些ViewController返回UIInterfaceOrientationMaskLandscape,为一个ViewController返回UIInterfaceOrientationMaskPortrait。当我从横向ViewController移动到纵向ViewController时,我想supportedInterfaceOrientationsForWindow返回UIInterfaceOrientationMaskPortrait但我

ios - 仅为 ios swift 2.3 和 swift 3 中的特定 View Controller 更改方向

当DeviceOrientation在项目settings中设置为Portrait。没有得到任何成功的结果。所以最后我找到了一种方法。这是项目设备方向看起来像....在swift2.3中添加如下方法overridefuncshouldAutorotate()->Bool{returnfalse}overridefuncsupportedInterfaceOrientations()->UIInterfaceOrientationMask{returnUIInterfaceOrientationMask.LandscapeLeft}overridefuncpreferredInterfa

iphone - 从 View B 移回 View A 时如何重置屏幕方向?

我必须有2个ViewController(A和B)。vcA是一个项目列表,它只支持纵向。您从列表中选择一个项目并被带到vcB(通过pushViewController),它显示有关所选项目的详细信息。vcB支持纵向和横向View。因此,当显示vcB时,假设设备旋转以将View更改为横向-当用户返回vcA(通过popViewController)时-vcA将以横向显示,而我不这样做'不想。我希望它以纵向显示。我怎样才能做到这一点?谢谢! 最佳答案 使A仅支持纵向:-(BOOL)shouldAutorotateToInterfaceOr

ios - 如何在第一个 View 中获取 statusBarOrientation

如何检测第一个View中应用程序的正确方向?我需要知道,这样我才能将纵向图像或横向图像显示为背景。[[UIDevicecurrentDevice]orientation]如果iPad平放在表面上,则无法正常工作。statusBarOrientation似乎没有为加载的第一个View返回正确的结果。我尝试在viewWillAppear中获取状态栏方向和viewDidLoad并且即使在横向时都返回Portrait。我已经确认我有[self.windowmakeKeyAndVisible]在我的AppDelegate.m在-(BOOL)application:(UIApplication*)

iphone - 游戏中心导致 UIApplicationInvalidInterfaceOrientation

我已经检查了这个问题的其他解决方案,但没有一个对我有用。如果我尝试在我的物理iPhone(不是模拟器;这在模拟器中有效)上验证GKLocalPlayer,我会收到以下错误:Terminatingappduetouncaughtexception'UIApplicationInvalidInterfaceOrientation',reason:'Supportedorientationshasnocommonorientationwiththeapplication,andshouldAutorotateisreturningYES'***Firstthrowcallstack:(0x3

iOS5、iOS6、旋转、事件任意触发

我有一个支持方向变化和相应旋转的应用程序。我听事件UIApplicationWillChangeStatusBarOrientationNotification。现在,在加载此应用程序期间,我添加了一些View并根据当前方向在我的应用程序中设置它们。在iOS6中,这工作正常并且应用程序响应和旋转正确,因此用户可以在横向和纵向模式下加载并且代码工作正常。在iOS5中,如果我以纵向模式加载应用程序,应用程序可以正常工作,一旦加载以纵向模式完成,并且UI已对齐和调整大小,它将响应其他方向更改为横向或肖像。我遇到的问题是:当以横向模式加载iOS5时,同时将装有iOS5的设备物理放置在平面上以确