为什么 XCode 4.5.1 中的 Ipad 模拟器在以编程方式 check out 时显示错误的大小?
主视图 Controller .m
- (void)viewDidLoad{
[super viewDidLoad];
[self.view setBackgroundColor:[UIColor redColor]];
NSLog(@"self.view width : %f",self.view.frame.size.width);
NSLog(@"self.view height : %f", self.view.frame.size.height);
mTextView = [[UITextView alloc] initWithFrame:CGRectMake(10.0, 10.0, self.view.frame.size.width - 20, self.view.frame.size.height/2)];
[self.view addSubview:mTextView];
}
我得到的输出是
self.view width : 320.000000
self.view height : 548.000000
我的项目规范
- 通用项目
- 针对 iOS 6.0
- 我绝对确定我选中了“targeted for ipad” 创建 MainViewController 时的复选框
- 不知道它是否重要,但是“用 xib 作为用户界面” 未检查。
这是添加了 TextView 的屏幕截图
最佳答案
关于iOS 6 - XCode 4.5.1 - iPad 模拟器 - 以编程方式获得错误的分辨率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13043734/