Skip to content

Instantly share code, notes, and snippets.

@naotokui
Created February 7, 2012 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naotokui/1756346 to your computer and use it in GitHub Desktop.
Save naotokui/1756346 to your computer and use it in GitHub Desktop.
- (void) presentModalViewControllerInSizeYouWant (for iPad)
- (void) presentModalViewControllerInSizeYouWant
{
float width = <width you wnat>;
float height = <height you wnat>;
UIViewController *viewCtl = [[UIViewController alloc] initWithNibName: @"UIViewController" bundle: nil];
viewCtl.modalPresentationStyle = UIModalPresentationFormSheet; // set presentation style
[self presentModalViewController:viewCtl animated: YES]; // show!
// Just after presenting the view, customize it now!
viewCtl.view.superview.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
viewCtl.view.superview.frame = CGRectMake(viewCtl.view.superview.frame.origin.x, viewCtl.view.superview.frame.origin.y,
width, height);
viewCtl.view.superview.center = self.view.center;
[viewCtl release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment