在自定义键盘扩展中,我们无法使用
`didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation`
Run Code Online (Sandbox Code Playgroud)
和sharedApplication.
我需要在旋转时检测键盘上的纵向或横向.
如何在Custom Keyboard扩展中检测方向更改?
ios8 ios-app-extension uiinputviewcontroller custom-keyboard
我正在iOS 8上使用自适应布局,我希望得到大小类的确切内容viewDidLoad.关于那个的任何想法?
我开发了iOS应用程序并在iOS6设备上进行了测试.在测试时,我意识到我的应用程序没有按预期响应方向更改.
这是我的代码:
// Autorotation (iOS >= 6.0)
- (BOOL) shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationMaskPortrait;
}
Run Code Online (Sandbox Code Playgroud)
确切地说,我想知道iOS中的方向更改调用了哪些方法.
在应用程序扩展中检测设备方向的最佳方法是什么?我在这里发现的解决方案的结果好坏参半:
我查看了大小类,UITraitCollection并发现设备不准确地报告它是纵向的,实际上是在横向(不确定这是OS错误,还是我没有正确查询正确的API).
完成的最佳方法是什么:
谢谢,