Customize / resize views using presentModalViewController

I use presentModalView to display a modal view in an iPad application when my application goes into active state:

- (void)applicationDidBecomeActive:(UIApplication *)application {  
  myViewController vc = [[myViewController alloc] init];  
  vc.modalPresentationStyle = UIModalPresentationFormSheet;  
  vc.modalTransistionStyle = UImdoalTransitionStyleCoverVertical;  
  [self.window.rootViewController presentModalViewController:vc animated:YES];  
}

It works great, however myViewController is only 320 X 340, but it appears in a much larger view. Is there a way to adjust or resize the view when using presentModalViewController? Or is there a way other than presentModalViewController to display a modal view?

+3
source share
1 answer

You can do this by resizing view.superview.frame as shown below:

vc.view.superview.frame = CGRectMake(0, 0, 900, 700);
+6
source

Source: https://habr.com/ru/post/1796141/


All Articles