Customize/override view size when using presentModalViewController
I'm using presentModalView to 开发者_运维知识库display a modal view in an iPad app when my app enters the 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 functions fine, however myViewController is only 320 X 340, yet it gets displayed as a much larger view. Is there anyway to customize or override the view size when using presentModalViewController? Or is there some way other than presentModalViewController to display a modal view?
You could do this by resizing the view.superview.frame like below:
vc.view.superview.frame = CGRectMake(0, 0, 900, 700);
精彩评论