[英]custom UIView how-to with IB / Xcode 4.5.1 and iOS Simulator 6.0
[英]iOS 6 - XCode 4.5.1 - iPad simulator - programatically getting wrong resolution
为什么以编程方式签出XCode 4.5.1中的Ipad模拟器显示错误的大小?
- (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
我的项目规格
这是添加了textview的屏幕截图
尝试使用以下代码来确定您的计算机了解该设备:
NSRange* pointRange = [[[UIDevice currentDevice] model] rangeOfString:@"iPad" options:0];
if (pointRange.location == NSNotFound) {
NSLog(@"iPhone");
}
else
{
NSLog(@"iPad");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.