Skip to content

Instantly share code, notes, and snippets.

@chrishulbert
Created August 17, 2011 05:45
Show Gist options
  • Select an option

  • Save chrishulbert/1150882 to your computer and use it in GitHub Desktop.

Select an option

Save chrishulbert/1150882 to your computer and use it in GitHub Desktop.
Resize things programmatically for landscape/portrait in iphone/objc
// Resize the controls
- (void)doMyResizing {
// Resize some stuff here
self.something.frame = something...
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self doMyResizing];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self doMyResizing]; // This is for some cases when the person uses this tab in portrait, changes to another tab, rotates to landscape, and switches back to this
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self doMyResizing];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment