Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I detect device orientation going back and forth through tabs and views?
    text
    copied!<p>My application goes back and forth between Portrait and Landscape. I have all of my content(labels, uiimageviews, uilabels) lined up to relocate for both orientations. However, the only change when the device is actually rotated. When I cycle between tabs after it has been rotated it just shows up autosized and not the way I have it setup when the user rotates it. </p> <p>How can I detect the orientation of the device and display the view to reflect the orientation when the taps different tabs?</p> <p>Ok, I set it to viewWillAppear. Is there a reason why it isn't detecting the orientation and displaying the content where I have set it?</p> <pre><code>-(void)viewWillAppear:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration{ UIInterfaceOrientation toOrientation = self.interfaceOrientation; [UIView beginAnimations:@"move buttons" context:nil]; [UIView setAnimationDuration:0.5f]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; if(toOrientation == UIInterfaceOrientationPortrait || toOrientation == UIInterfaceOrientationPortraitUpsideDown) { aboutContent.frame = CGRectMake(20, 100, 280, 107); myLogo.frame = CGRectMake(-5, 20, 330, 65); bulletOne.frame = CGRectMake(40, 220, 240, 45); bulletTwo.frame = CGRectMake(40, 270, 240, 45); } else { aboutContent.frame = CGRectMake(40, 80, 400, 70); myLogo.frame = CGRectMake(230, 30, 20, 20); bulletOne.frame = CGRectMake(90, 140, 330, 65); bulletTwo.frame = CGRectMake(90, 170, 330, 65); } [UIView commitAnimations]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload