Reputation: 501
I have a UIViewController, which on it - I use presentViewController to present a new window:
controller.view.frame = source;
[self presentViewController:controller animated:NO completion:nil];
[UIView animateWithDuration:ANIMATION_NORMAL_DURATION animations:^{
controller.view.frame = target;
}completion:^(BOOL finished) {
}];
When I do that - the parent controller (self) disappears before the new controller (controller) appears. And it makes it ugly.
Is there a better way to implement it? (I don't use NavigationControler in those ViewContollers)
Thanks.
Upvotes: 1
Views: 1628
Reputation: 912
From iOS7 there is the modalPresentationStyle property. Set it to one of this options: UIModalPresentationOverFullScreen, UIModalPresentationOverCurrentContext, UIModalPresentationCustom
modalViewController.modalPresentationStyle = UIModalPresentationCustom;
Upvotes: 3
Reputation: 2827
do not present, just add a subview
controller.view.frame = source;
//[self presentViewController:controller animated:NO completion:nil];
[self.view addSubview:controller.view];
[UIView animateWithDuration:ANIMATION_NORMAL_DURATION animations:^{
controller.view.frame = target;
}completion:^(BOOL finished) {
}];
Upvotes: 0