我创建了一个仅在横向模式下工作的应用。启动画面工作正常,但在启动画面后我的第一页未设置为横向模式。我附上了屏幕截图,在这里我给出了支持定位方法的代码。我通过打印它显示的值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);
}
答案 0 :(得分:1)
检查应用代表。导航控制器是否已正确初始化?