以模态方式呈现视图控制器并在此之后调整视图的大小,但之后调整大小的视图不会进入中间位置。在 iOS 版本 < 7.0 上工作
代码片段:
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:aViewController];
nav.modalPresentationStyle = UIModalPresentationFormSheet;
CGRect rect = MSIPhoneUtils::MainRect([UIApplication sharedApplication].statusBarOrientation);
nav.navigationBarHidden = YES;
[self PresentControllerModally:nav withAnimation:YES];
nav.view.superview.frame = CGRectMake((rect.size.width - 320) / 2,(rect.size.height - 480) / 2, 320, 480);
nav.view.superview.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
aViewController.view.superview.frame = CGRectMake((rect.size.width - 320) / 2,(rect.size.height - 480) / 2, 320, 480);
aViewController.view.superview.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;