我有两个视图控制器,我在FirstViewController中有一些视频,如果我点击视频它会在带有横向模式的SecondViewController上显示,再次点击后退按钮后,FirstViewController应该出现在Potrait模式中。这是我的代码
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
但它不适合我。
由于
答案 0 :(得分:0)
RootViewController的
@property (nonatomic, retain) BOOL autoRotate;
@property (nonatomic, retain) UIInterfaceOrientation interfaceOrientation;
-(void)setAutorate:(BOOL)newValue
{
_autoRotate = newValue;
}
-(void)setInterfaceOrientation: (UIInterfaceOrientation)newInterface
{
_interfaceOrientation = newInterface;
}
-(BOOL)shouldAutorotate
{
return _autoRotate;
}
-(UIInterfaceOrientation)supportedInterfaceOrientation
{
return _interfaceOrientation;
}
在secondView控制器中,您必须在viewDidAppear中调用setter方法来修改值。然后,在viewDidDisappear中,或者当您关闭控制器时,您将重置值。