gpt4 book ai didi

ios - ios,Web View 中的Youtube全屏旋转

转载 作者:行者123 更新时间:2023-12-01 17:12:23 26 4
gpt4 key购买 nike

我正在开发和想要在页面上放置youtube视频的应用程序。
它可以与下面的代码一起正常工作:

-(void)viewDidLoad{
[super viewDidLoad];

}

- (void) viewWillAppear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:NO animated:YES];
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:.47 green:.43 blue:.4 alpha:1];

}

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
//return (interfaceOrientation == UIInterfaceOrientationPortrait);
NSString *htmlString;
if(interfaceOrientation == UIInterfaceOrientationPortrait){
htmlString = [NSString stringWithFormat:@"<html><head><meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 20\"/></head><body style=\"background:#F00;margin-top:0px;margin-left:0px\"><div><object width=\"768\" height=\"960\"><param name=\"movie\" value=\"%@\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"%@\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"768\" height=\"960\"></embed></object></div></body></html>",urlToOpen,urlToOpen];

}else{
htmlString = [NSString stringWithFormat:@"<html><head><meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 212\"/></head><body style=\"background:#F00;margin-top:0px;margin-left:0px\"><div><object width=\"1024\" height=\"704\"><param name=\"movie\" value=\"%@\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"%@\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"1024\" height=\"704\"></embed></object></div></body></html>",urlToOpen,urlToOpen];

}
[self.webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];
return YES;
}

该 View 在纵向和横向都可以正常工作。
问题是当我看到全屏视频并旋转时。当我完成全屏显示时,Web View 未检测到旋转并以错误的方式打印了Web View 。

如何检测YouTube全屏旋转以旋转 View ?

谢谢

最佳答案

将内容宽度设置为100%

我的模板

<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> \
<html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> \
<meta name=\"viewport\" content=\"width=320\"> \
<style> \
html,body {-webkit-text-size-adjust: none; size:100%%} \
body {margin: 0; padding: 0;width:100%;} \
table { font-family:Georgia; font-size:%dpt; border-style: none; size:100%%} \
</style> </head>

....

关于ios - ios,Web View 中的Youtube全屏旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8128095/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com