如何修复ipad中的Orientation错误?

时间:2013-11-06 07:55:19

标签: ios objective-c ipad uinavigationcontroller

我创建了一个仅在横向模式下工作的应用。启动画面工作正常,但在启动画面后我的第一页未设置为横向模式。我附上了屏幕截图,在这里我给出了支持定位方法的代码。我通过打印它显示的值0,0,768,1024检查绑定大小,但我想要0,0,1024,768。Screen shot

//checking the frame size
CGRect theRect = self.view.bound;

NSLog(@" frame %f  %f  %f  %f", theRect.origin.x,
      theRect.origin.y,
      theRect.size.width,
      theRect.size.height);

//orientation method
- (BOOL) shouldAutorotate
{
return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
 }
 -(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
UIInterfaceOrientation crntOrntatn = self.interfaceOrientation;
return UIInterfaceOrientationIsLandscape(crntOrntatn) ? crntOrntatn :      UIInterfaceOrientationLandscapeLeft;
}

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
 {
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
 }

1 个答案:

答案 0 :(得分:1)

检查应用代表。导航控制器是否已正确初始化?