我正在使用IIViewDeckController,并且遇到了一个非常奇怪的问题,如下所示:
我的ViewController(这是一个IIViewDeckController)处于横向模式,然后我在它上面提供了一个新的视图控制器。现在,模式视图控制器不支持横向模式,因此仅以纵向模式呈现。
到目前为止,一切都很顺利。
但是只要我尝试取消这个以模态呈现的控制器,IIViewDeckController's视图的框架就变成(320,568) (我认为这个IIViewDeckController已经旋转到纵向模式,但我不确定)。所以我检查了self.interfaceOrientation,它显示“4”(即UIInterfaceOrientationLandscapeLeft),这应该是实际的情况。
但这两件事让我感到困惑,因为框架显示的是肖像模式,属性显示的是不同的东西。现在,由于这个框架在没有改变interfaceOrientation的情况下改变,导致在视图中错误地计算对象的框架。
发布于 2014-03-10 15:03:17
我也遇到过同样的问题,我通过在AppDelegate类中对IIViewDeckController进行分类来解决这个问题。
以下是需要分类的一种方法:
@interface IIViewDeckController (categoryForOrientation)
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation;
@end
@implementation IIViewDeckController (categoryForOrientation)
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return [self interfaceOrientation];
}https://stackoverflow.com/questions/21307037
复制相似问题