我有一个名为 QueryView
的 UIWindow
子类,如下所示:
QueryAlertView *queryAlertView = [QueryAlertView queryAlertViewWithType:queryAlertViewType message:message];
queryAlertView.queryAlertViewDelegate = self;
self.currentAlertView = queryAlertView;
queryAlertView.rootViewController = self;
[queryAlertView makeKeyAndVisible];
[queryAlertView launchKeyboard];
- (void) launchKeyboard
{
[self.textField becomeFirstResponder];
}
当我在横向启动 QueryAlertView
时,有时它不会旋转到正确的方向。我无法重现此错误,也不确定是什么原因造成的。我想知道,有人能看出我的代码中可能导致这种情况的缺陷吗,或者这是一个 iOS8
错误?
最佳答案
这不是一个错误,将 UIView 附加到 UIWindow 不会知道它的方向,只有 UIViewController 可以知道。 将任何东西附加到 UIWindow 绝对是一件痛苦的事情。
IMO,这是一种更好的方法,例如 https://github.com/TeehanLax/UIViewController-Transitions-Example 这使用了 iOS 7 的 UIViewController 动画转换,因此此代码可重复用于您想要在顶部呈现的任何 View Controller 。
关于ios - UIKeyboard 弹出时 UIWindow 子类不旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30316012/