Automatically center a UIImageView after rotation
<p>I have an UIImage inside an UIImageView in my application.</p>

<p>In portrait mode, the image is centered but when I switch to the landscape mode it stills on the left.</p>

<p>So I added the following method in my .m file but the problem is that I have a TabBar application, so when I rotate the device on another tab and I go back to the tab containing the image, it doesn't rotate automatically.</p>

<p>There is a way to rotate automatically all the elements of the application when rotating the device on any tab ?</p>

<pre><code>
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight)){
        background.image = [UIImage imageNamed:@"back2-landscape.png"];
    } else  if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown)){
        background.image = [UIImage imageNamed:@"back2-portrait.png"];
    }
}
</code></pre>

<p>Thank you :-)</p>
