Bha*_*ath 20 ipad uiinterfaceorientation autoresizingmask ios6 iphone-5
我在用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
委托根据方向类型更改视图的框架
即
if(UIInterfaceOrientationIsLandscape(interfaceOrientation))
{
self.view.frame=CGRectMake(0,0,500,300);
}
else
{
self.view.frame=CGRectMake(0,0,300,400);
}
Run Code Online (Sandbox Code Playgroud)
如何在iOS 6中处理相同的情况
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
Run Code Online (Sandbox Code Playgroud)
已在iOS6中弃用.
我正在使用以下委托来设置所有方向.
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationAllMask;
}
Run Code Online (Sandbox Code Playgroud)
但,
-(BOOL)shouldAutoRotate
{
return YES;
}
Run Code Online (Sandbox Code Playgroud)
没有被调用.如何处理这种情况?

Bha*_*ath 46
在AppDelegate中,我将ViewController对象添加到窗口中
[self.window addSubView:viewControllerObj]
问题出在上述方面.方向将适用于iOS 5中的上述行,但在iOS中,为了使方向正常工作,请更改上面的行
[self.window setRootViewController:viewControllerObj]
然后应用程序在方向更改时旋转.