![](/img/trans.png)
[英]How to present a view controller in portrait or landscape, in application that is portrait-only
[英]Present a modal landscape View Controller from a portrait View Controller
我有一個僅提供肖像的VC,它提供了僅提供風景的VC。 我正在努力查看如何使它工作。 在呈現模態VC之后,我可以調用一個動畫來旋轉VC,但運氣不錯,但看起來有些晦澀。
我堅持使用iOS 4.3,因此沒有故事板。
我想要的是...
[landscapeVC setOrentation:UIDeviceOrentaionLanscape];
[portraitVC presentModalViewController:landscapeVC Animated:YES];
謝謝你的幫助
在portraitVC的viewDidLoad方法和shouldautorotate方法中使用此方法:
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
[[self view] setBounds:CGRectMake(0, 0, 480, 320)];
[[self view] setCenter:CGPointMake(160, 240)];
[[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.