启动应用程序我有,我只想与景观工作的应用程序。在横向模式下
这是第一次,我在前述IB,并试图以编程方式设置了我所有的意见,所以我创建一个视图和方法的loadView加入一串子视图:
self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
self.mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
self.mapView.myLocationEnabled = YES;
self.mapView.delegate = self;
self.mapView.mapType = kGMSTypeHybrid;
self.mapView.frame = self.view.frame;
[self.view addSubview:self.mapView];
// add the toolbar
UIToolbar* toolbar = [[UIToolbar alloc] init];
toolbar.frame = CGRectMake(0, self.view.frame.size.height - 44, self.view.frame.size.width, 44);
toolbar.barStyle = UIBarStyleDefault;
NSMutableArray* items = [NSMutableArray array];
[items addObject:[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"location-arrow.png"]
style:UIBarButtonItemStyleBordered
target:self
action:@selector(locateMe:)]];
[items addObject:[[UIBarButtonItem alloc] initWithTitle:@"Tools"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(toolsButtonTapped:)]];
[toolbar setItems:items];
[self.view addSubview:toolbar];
在我的项目设置,我禁用了两个肖像方向。我也有这个在我的根视图控制器:
// Enforce Landscape Orientation
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
我的问题是在横向模式下开始,但所有的意见是尺寸适于人像模拟器 - 所以我的看法底部块低于屏幕和我的屏幕右侧是一个很大的空白区域。
我试图通过切换应用框架的宽度和高度在第一线固定这一点,但然后离开屏幕的状态栏的左边缘一些空垂直空间。
那么,有什么做什么,我试图做的正确方法是什么?
只是想知道,在测试时会发生什么设备? – Squatch
你可以尝试'self.view.transform = CGAffineTransformMakeRotation(M_PI/2);' –
@Squatch:这是一个新客户端的应用程序,所以它是用他们的帐户创建的,我不能以成员身份加入直到会员中心恢复正常,所以我无法在设备上运行它。 – Shinigami