Iphone iiview甲板控制器在显示模态视图时更改框架而不更改接口方向
我正在使用Iphone iiview甲板控制器在显示模态视图时更改框架而不更改接口方向,iphone,ios7,modalviewcontroller,viewdeck,iiviewdeckcontroller,Iphone,Ios7,Modalviewcontroller,Viewdeck,Iiviewdeckcontroller,我正在使用IIViewDeckController并面临一个非常奇怪的问题,如下所示: 我的ViewController(它是一个iviewdeckcontroller)处于横向模式,然后我在其上以模态方式呈现了一个新的视图控制器。现在,模态视图控制器不支持横向模式,因此仅在纵向模式下显示。 到现在为止,一切都很顺利 但是,当我尝试关闭这个模式显示的控制器时,iviewdeckcontroller的view的帧变成(320568)(我认为这个iviewdeckcontroller已经旋转到纵向模
IIViewDeckController
并面临一个非常奇怪的问题,如下所示:
我的ViewController
(它是一个iviewdeckcontroller
)处于横向模式,然后我在其上以模态方式呈现了一个新的视图控制器。现在,模态视图控制器不支持横向模式,因此仅在纵向模式下显示。到现在为止,一切都很顺利 但是,当我尝试关闭这个模式显示的控制器时,
iviewdeckcontroller的
view的帧变成(320568)(我认为这个iviewdeckcontroller
已经旋转到纵向模式,但我不确定)。因此,我检查了self.interface-orientation
,其中显示了“4”(即ui-interface-orientation和scapeleft
),这应该是实际情况
但这两件事让我很困惑,因为画面显示的是肖像模式,而属性显示的是不同的东西。现在,由于在不更改
界面方向的情况下更改帧,导致视图中对象帧的计算错误。我遇到了同样的问题,我通过在AppDelegate类中分类IIViewDeckController
解决了这个问题
以下是一种需要分类的方法:-
@interface IIViewDeckController (categoryForOrientation)
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation;
@end
@implementation IIViewDeckController (categoryForOrientation)
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return [self interfaceOrientation];
}