簡體   English   中英

iPhone旋轉不會旋轉UIWebView

[英]iPhone rotation won't rotate UIWebView

我的視圖層次結構如下所示:

標簽欄->導航欄->表格視圖->視圖1->視圖2(UIWebView)

如何旋轉視圖2,使其可以橫向和縱向顯示?

這是您的解決方法...只是解決了相同的問題。 問題是選項卡欄控制器對shouldRotate方法沒有響應。

忽略蘋果文檔中的建議,並為選項卡視圖控制器創建一個子類。 在該子類中處理shouldRotate

-(BOOL)應該AutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {//始終返回YES意味着視圖將旋轉以適應任何方向。 返回是; }

這是我完整的子類TSTabBarController.h

#import <Foundation/Foundation.h>
@interface TSTabBarController : UITabBarController {

}

@end

和實施文件。

#import "TSTabBarController.h"


@implementation TSTabBarController
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Always returning YES means the view will rotate to accomodate any orientation.
    return YES;
}


@end

如果您在IB中更改選項卡欄控制器的類,則應該可以使用。

希望這可以幫助。
豐富

暫無
暫無

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

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