views:

348

answers:

1

Hi there..

I have developed my first iphone app, but have some problems with the auto rotation. After a rotation the screen is cut off, and I have to switch to another tab and then back to get it right..

I guess, if I can reload the the view after the rotation, it will probably work fine.. Any tips on how to do that (or alternative solutions)?

Thanks! :)

A: 

This could be many things, such as auto-resizing of your views as set up in code or in Interface Builder. Or it could be that you need something along these lines:

if (portrait) {
 self.view.transform = CGAffineTransformMakeRotation(0);
 self.view.bounds = CGRectMake(0.0, 0.0, 320, 480);
}
else {
 self.view.transform = CGAffineTransformMakeRotation((M_PI * (90) / 180.0));
 self.view.bounds = CGRectMake(0.0, 0.0, 480, 320);
}
mahboudz