I am recreating a popup style view controller. In the implementation below I am instantiating a view controller and then presenting it on its parent VC modally using the option UIModalPresentationOverCurrentContext
.
I would like to reduce the frame size so as to make the new viewcontroller appear more like a popup but the frame size keeps getting overwritten. I also tried setting the frame size of the viewcontroller in its -viewWillAppear
and -viewDidLoad
methods but nothing changes. Any thoughts?
UIStoryboard* popStoryboard = [UIStoryboard storyboardWithName:@"XXX" bundle:nil];
UIViewController* popViewController = [storyboard instantiateViewControllerWithIdentifier:@"XXXXXX"];
popViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
popViewController.view.frame = CGRectMake(0, 0, 400, 450);
[[self topMostViewController] presentViewController:popViewController animated: YES completion: nil];
您正在使用名为popViewController
的指针变量实例化视图控制器,但您更改视图的框架并显示名为viewController
的指针变量。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.