【发布时间】:2015-08-21 09:07:25
【问题描述】:
我正在为 iPad 横向模式创建应用程序。我为整个屏幕创建了一个 UIView。但它并没有将整个屏幕显示为 1024 的宽度。它显示为 768 的宽度(表示 0 到 768)。
backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[backgroundView setBackgroundColor:[[UIColor greenColor]colorWithAlphaComponent:0.5]];
backgroundView.opaque = NO;
backgroundView.userInteractionEnabled = YES;
backgroundView.clearsContextBeforeDrawing=YES;
[self.view addSubview:backgroundView];
CGFloat x = self.view.frame.size.width;
NSLog(@"size%f",x); // 768
当我在 iPad 2 (7.1) 模拟器中运行时会发生这种情况
请指教。
【问题讨论】:
标签: ios objective-c ipad landscape device-orientation