0

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

//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);
 }
4

1 回答 1

1

检查应用委托。导航控制器已正确初始化?

于 2013-12-04T12:51:44.627 回答