Why is Ipad simulator in XCode 4.5.1 shows wrong size when checking out programatically?
MainViewController.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];
}
and I am getting output as
self.view width : 320.000000
self.view height : 548.000000
My project specification
- Universal project
- targeting iOS 6.0
- I am absolutely certain that I checked “targeted for ipad”
checkbox when creating MainViewController - Dont know whether it is important, but “with xib for user interface”
was unchecked.
And here is a screen shot with a textview is added

Try waiting until:
before setting the frame of your UITextView. According to this post you won’t have valid geometry for your view before then.