简体   繁体   English

轻按后退按钮时,iOS 8屏幕滑动方向错误

[英]iOS 8 Screen slides wrong direction when back button tapped

My application was written for iOS7 and I am trying to get it updated to iOS 8. My application is configured to only work in Landscape Left and Landscape Right orientations. 我的应用程序是为iOS7编写的,我正尝试将其更新为iOS8。我的应用程序配置为仅在“横向左”和“横向右”方向上工作。

For iOS 8 I changed the order by which the screens are navigated and changed one of the modal screens to a push transition. 对于iOS 8,我更改了屏幕导航的顺序,并将其中一种模式屏幕更改为推送过渡。 On the main screen I have two UIBarButtonItems on the UINavigationItem. 在主屏幕上,我在UINavigationItem上有两个UIBarButtonItems。 Each of these have a push segue assigned to them that connects to different screens. 它们中的每一个都有分配给他们的推送选择,可以连接到不同的屏幕。

When the app is running and one of the UIBarButtonItems is tapped, the screen associated through the segue slides over the main screen as expected. 当应用程序运行并且敲击UIBarButtonItems之一时,通过segue关联的屏幕将按预期在主屏幕上滑动。 The back button is displayed normally. 后退按钮正常显示。 The problem occurs when the back button is tapped. 轻按后退按钮时,会发生此问题。 The screen does not slide off to the right as would be expected. 屏幕不会像预期的那样向右滑动。

On an iPhone 4 running iOS 7 the screen always slides down (towards the ground) regardless of the devices landscape left or landscape right orientation. 在运行iOS 7的iPhone 4上,无论设备横向向左还是横向向右,屏幕始终会向下滑动(朝向地面)。

On an iPhone 6 Plus running iOS 8 the called screen quickly rotates to Upside Down (top towards the home button) and then slides off to home button side. 在运行iOS 8的iPhone 6 Plus上,被叫屏幕会快速旋转到“上下颠倒”(顶部朝着“主页”按钮),然后滑到“主页”按钮侧。 Again it doesn't matter which way the phone is oriented landscape left or landscape right orientation. 同样,手机以横向还是横向都没有关系。

I have tried setting the preferredInterfaceOrientationForPresentation, shouldAutorotate to NO, and setting the supportedInterfaceOrientations to UIInterfaceOrientationLandscapeRight | 我试过设置preferredInterfaceOrientationForPresentation,应当将AutoAutorotate设置为NO,并将supportedInterfaceOrientations设置为UIInterfaceOrientationLandscapeRight。 UIInterfaceOrientationLandscapeRight. UIInterfaceOrientationLandscapeRight。 Nothing seems to make any difference at all. 似乎没有任何改变。

My screen navigation is straight forward, I'm no using any custom transitions. 我的屏幕导航非常简单,我没有使用任何自定义过渡。 It's all through standard push segues. 这都是通过标准的推播功能完成的。

I need to get the screen "back" transitions working correctly again. 我需要让屏幕的“后退”过渡再次正常工作。

Any help is greatly appreciated! 任何帮助是极大的赞赏!

I have finally discovered what was causing my screens to slide the wrong direction. 我终于发现了导致屏幕滑动方向错误的原因。 It turns out that overriding the supportedInterfaceOrientations method in the UIViewController and returning UIInterfaceOrientationLandscapeRight | 事实证明,重写UIViewController中的supportInterfaceOrientations方法并返回UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft confuses the transition in iOS 8 (and devices running iOS 7 also). UIInterfaceOrientationLandscapeLeft混淆了iOS 8(以及也运行iOS 7的设备)中的过渡。 This was needed for proper operation in iOS 7, but evidently causes problems in iOS 8. So once I removed the code, the screen transitions began working correctly again. 这对于在iOS 7中正常运行是必需的,但显然会在iOS 8中引起问题。因此,一旦删除代码,屏幕过渡就会再次正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM