簡體   English   中英

如何自動旋轉僅第一視圖和第二視圖僅橫向模式iOS6

[英]How to auto rotate first view only portrait and second view only landscape mode ios6

如何自動旋轉僅第一視圖和第二視圖僅橫向模式iOS6

我在第一眼就這樣嘗試過

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

在第二個/詳細信息視圖中

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

-(BOOL) shouldAutorotate{
    return YES;
}

首先是在UINavigationController中。

如果是這樣,則應子類化UINavigationController並將以下內容添加到子類中:

#pragma mark - Auto Rotation
-(BOOL)shouldAutorotate {
    return [self.topViewController shouldAutorotate];
}

-(NSUInteger)supportedInterfaceOrientations {
    return [self.topViewController supportedInterfaceOrientations];
}

然后,在每個VC中,您可以覆蓋需要和不需要自動旋轉的方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM