Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

presentViewController is moving my rootViewController

I would like to know if anyone have an idea about a problem I have !

I have a simple viewController, with a custom appDelegate.window.frame (0, 20, width, height), with its own navigationController. I implemented a UIButton, that present an empty view controller.

UIViewController *v = [_controllersList objectAtIndex:indexPath.row];
        v.modalPresentationStyle = UIModalPresentationCurrentContext;
        [self presentViewController:v animated:YES completion:nil]; 

By now, everything is working. If I present that new controller (everything is fine with it!). When I dismiss the new view, my original view controller frame has changed graphically but not programmatically!

(The result is that my window is stuck to the top of the view, and cropped, with 20 blacks pixel to the bottom).

like image 423
UIChris Avatar asked May 10 '26 18:05

UIChris


2 Answers

For me the solution was changing the default modalPresentationStyle property:

v.modalPresentationStyle = UIModalPresentationOverFullScreen;

Hope it helps.

like image 56
Pedro Góes Avatar answered May 12 '26 09:05

Pedro Góes


you can present the view controller from the window rootviewcontroller

[self.view.window.rootViewController presentViewController:v animated:YES completion:nil];
like image 20
Chuy47 Avatar answered May 12 '26 07:05

Chuy47



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!