Note that there are some explanatory texts on larger screens.

plurals
  1. POset the frame size when orientation is changed in ios
    text
    copied!<p>I want to change the orientation of a view in ios 6. When the orientation is changed, I want to set the frame size of the views.</p> <p>My Sample Code for orientation change:</p> <pre><code>-(BOOL)shouldAutorotate { return YES; } -(NSInteger)supportedInterfaceOrientations { NSInteger mask = 0; intOrientation = [[UIApplication sharedApplication] statusBarOrientation]; if(intOrientation == UIInterfaceOrientationPortrait || intOrientation == UIInterfaceOrientationPortraitUpsideDown) { mask |= UIInterfaceOrientationMaskPortrait; } else if(intOrientation == UIInterfaceOrientationLandscapeLeft) { mask |= UIInterfaceOrientationMaskLandscapeLeft; } } NSLog (@"mask %d",mask); return mask; } // Here now mask value is 2 because my default mode is portrait. </code></pre> <p>Now when I change my orientation to landscape, I want to set the frame size. Please guide me on how to do that.</p> <p>ok..Can I set the frame size for the view like dis by taking the version and comparing it in viewdidLoad: </p> <pre><code>orientation = [[UIDevice currentDevice] orientation]; NSString *reqSysVer = @"6.0"; NSString *currSysVer = [[UIDevice currentDevice] systemVersion]; NSLog (@"ios version %@",currSysVer); if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending) { if (orientation == UIInterfaceOrientationMaskPortrait) { self.view.frame = CGRectMake(0, 0, 1000, 800); self.tableView1.frame = CGRectMake(1, 0, 764,510); } else if (orientation == UIInterfaceOrientationMaskLandscapeLeft) { self.view.frame = CGRectMake(0, 0, 1300, 370); self.tableView1.frame = CGRectMake(0, 0, 1300, 370); self.view.backgroundColor = [UIColor blackColor]; } } </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