av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁技術文章
文章詳情頁

objective-c - 如何旋轉嵌入UIWebView的視頻(iOS 7)?

瀏覽:133日期:2024-04-12 11:42:38

問題描述

我在開發的APP是面向肖像的,但是當運行視頻(內嵌在webview)的時候,我需要在風景模式下重新定位視頻。應該怎么解決這一問題呢?我找到了一種解決方案,似乎可以解決問題。我覺得這是因為iOS 7的更新,但是我不確定。所以,這是我先前使用的,但是現在不起作用了,因為窗口和類名總是nil。

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{id presentedViewController = [window.rootViewController presentedViewController];NSString *className = presentedViewController ? NSStringFromClass([presentedViewController class]) : nil;if (window && [className isEqualToString:@'MPInlineVideoFullscreenViewController']) { return UIInterfaceOrientationMaskAll;} else { return UIInterfaceOrientationMaskPortrait;}

原問題:How to rotate a video embed in UIWebView (for iOS 7 only)?

問題解答

回答1:

答案:Denisia我自己找到了解決方法!在AppDelegate中執行如下方法,成功了!我的問題是,開始的時候,我沒有檢查右視圖控制器(view controller)。

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {NSString *className = NSStringFromClass([window class]);if ([((UINavigationController *)window.rootViewController) respondsToSelector:@selector(visibleViewController)]) { className = NSStringFromClass([((UINavigationController *)window.rootViewController).visibleViewController class]);}if ([className isEqualToString:@'MPFullscreenWindow'] || [className isEqualToString:@'MPInlineVideoFullscreenViewController']) { return UIInterfaceOrientationMaskAll;} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ return UIInterfaceOrientationMaskLandscape;} else { return UIInterfaceOrientationMaskPortrait;}

Immi試試這個:

-(BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation{return YES;}

如果你想在屏幕不顯示視頻的時候,不讓UIViewController旋轉,就使用下面的:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{if(webView && webView.superView) return YES;return UIInterfaceOrientationIsPortrait(interfaceOrientation);}

標簽: web
相關文章:
主站蜘蛛池模板: 国产激情一区二区三区 | 国产欧美一区二区三区免费 | 麻豆久久久 | 亚洲午夜精品久久久久久app | 欧美13videosex性极品 | 99国内精品| 国产成人一区二区三区精 | 一区二区三区av | 日韩精品一区二区三区 | 精品亚洲一区二区 | 国产视频精品在线观看 | 日韩在线看片 | 黄色片视频 | 在线四虎 | 一区二区三区在线免费看 | 超碰精品在线 | 日韩欧美福利视频 | 免费精品一区 | 黄色在线免费观看视频 | 国产视频在线观看一区二区三区 | 久久国产精品99久久久大便 | 久久99精品国产 | 国产精品久久久久久久久久久免费看 | 免费成人高清在线视频 | 欧美专区在线 | 国产一区二区不卡 | 伊人天堂网| www.久久 | 99亚洲精品 | 欧美一区二区小视频 | 亚洲欧美综合网 | 久久久久国产一区二区三区四区 | 国产日韩av一区二区 | 国产精品久久久久久吹潮 | 国产精品久久久久久久久久妇女 | 伊人网站 | 日本一区二区三区免费观看 | 亚洲精品一区二区网址 | 精品国产乱码久久久久久88av | 亚洲精品乱码久久久久久按摩 | 成人精品鲁一区一区二区 |