UIModalPresentationFormSheet on iPad in landscape mode

不打扰是莪最后的温柔 提交于 2019-12-09 23:41:17

问题


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


回答1:


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.




回答2:


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;
}];


来源:https://stackoverflow.com/questions/3044262/uimodalpresentationformsheet-on-ipad-in-landscape-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!