可编程iPhone横向方向锁
iPhone有一个方向锁,仅用于纵向。因此,我在我的UI中添加了一个横向方向锁定按钮,该按钮将可编程iPhone横向方向锁,iphone,locking,landscape,Iphone,Locking,Landscape,iPhone有一个方向锁,仅用于纵向。因此,我在我的UI中添加了一个横向方向锁定按钮,该按钮将横向方向锁定变量设置为是或否。然后在shouldAutorotateToInterfaceOrientation:中,我基本上执行以下操作: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (landscape_orientation_locked)
横向方向锁定
变量设置为是
或否
。然后在shouldAutorotateToInterfaceOrientation:
中,我基本上执行以下操作:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (landscape_orientation_locked)
return (UIInterfaceOrientationIsLandscape(interfaceOrientation));
return YES;
}
除了一种情况外,这种方法效果很好。当我将iPhone转到横向时,切换方向锁定按钮,将iPhone旋转到纵向,然后再次按下按钮。界面方向不会从横向更改为纵向。iPhone必须先转向横向,然后转向纵向,才能触发界面旋转
因此,我的问题是:我是否可以“强制”iPhone重新评估其当前方向?呈现并取消模拟模态视图控制器应该强制进行方向检查 编辑:找到了我第一次读到的问题:
我也读到了关于这个把戏的报道。不幸的是,它似乎不再起作用了。