1
votes

I am making an iPad app that starts out in the portrait orientation but can rotate over to the landscape orientation. In -(void) loadView, I call the function drawView. In drawView, I have this line of code:

CGRect r = [[UIScreen mainScreen] bounds];

The only problem is that it doesn't update itself when I rotate to landscape mode, so it still thinks that the screen is in the vertical orientation and if I want a text view to extend all the across the entire screen, it cuts it off at the 768th pixel, instead of the 1024th pixel. In -(BOOL)shouldAutorotate... I have case UIInterfaceOrientationLandscapeRight: and case UIInterfaceOrientationLandscapeLeft:, and I would have to ideally place CGRect r = [[UIScreen mainScreen] bounds]; under each case, but I don't think that will work. Any suggestions? Thanks for your help!

Edit: I've even tried calling a function with

CGRect r = [[UIScreen mainScreen] bounds];

in it, but it still won't work. I place an NSLog after it and I received a response, so the app is definitely working properly and not crashing, but I am still unable to figure this out. Any ideas? Thanks for your help!

2

2 Answers

0
votes

I think your problem could be solved by using the autoresizingMask of UIView;

0
votes

Does your app happen to rely on plists for configuration? I've seen some apps where you can get landscape but only after you set an orientation key to false.