2017-03-08 29 views
0

當呈現視圖控制器,我想它採取iPhone portrate模式屏幕寬度/高度的100%,而是採取屏幕的一部分在橫向(這樣):presentViewController寬度

Landscape

並在iPad上進行部分操作。下面的代碼做的一切,除了部分在iPhone景觀:

SQLProEditConnetionViewController * editConnectionViewController = 
    [[SQLProEditConnetionViewController alloc] initWithConnectionModel: nil]; 

editConnectionViewController.delegate = self; 

UINavigationController * navController = 
    [[UINavigationController alloc] initWithRootViewController: editConnectionViewController]; 

navController.modalPresentationStyle = UIModalPresentationFormSheet; 
navController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
navController.preferredContentSize = CGSizeMake(320, 620); // size of popup view 

[self presentViewController: navController 
        animated: YES 
       completion: nil]; 

任何想法如何,我可以正常得到這個爲iPhone橫向模式工作?

+0

您可能想使用容器視圖來實現這一點,而不是僅僅在當前視圖上呈現UIViewController。查看Apple的文檔:https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html#//apple_ref/doc/uid/TP40007457-CH11-SW13(特別是使用'addChildViewController:'和在當前的'UIViewController'上設置它的框架)。 –

回答

0

在您的代碼中更改此項:modalPresentationStyle

navController.modalPresentationStyle = UIModalPresentationFullScreen; 

希望這會工作......!

+0

不,這仍然涵蓋了所有內容,如下所示:http://i.imgur.com/JLrM2Vt.png。 – Kyle

0

在iPhone和iPod touch上,呈現的視圖始終爲全屏。在iPad上,演示文稿取決於modalPresentationStyle屬性中的值。

0

事實證明,我看到這是由於iPhone SE模擬器。在較大的設備上,它的工作原理是我想要的。