UIModalPresentationFormSheet on iPad in landscape

2019-04-16 04:38发布

I created a UIViewController view from XIB with modalPresentationStyle set to UIModalPresentationFormSheet and everything works great in portrait mode. When I switch to landscape the view gets moved upperleft (it's not centered as it should be) and most part of it is clipped.

Any ideas why this is happening and how to solve it?

Thanks

2条回答
The star\"
2楼-- · 2019-04-16 05:38

I had this problem as well. Turned out, I had the autorotate function set to Portrait for both the modal controller and the calling controller.

查看更多
一夜七次
3楼-- · 2019-04-16 05:43

In iOS 7, to solve the problem of the modal view controller to appear to the left after apparition of the keyboard (problem that I have when I present an EKEventEditViewController in UIModalPresentationFormSheet, I do :

[self presentViewController:modalViewController animated:YES completion:^{
    modalViewController.view.superview.center = self.view.center;
}];
查看更多
登录 后发表回答