페이지에서 YouTube 동영상을 원하는 앱을 개발하고 있습니다.ios, webview의 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;
}
뷰 세로 및 가로 잘 작동 : 그것은 아래의 코드 잘 가지 작동합니다. 문제는 전체 화면과 i 회전으로 비디오를 볼 때입니다. 전체 화면이 끝나면 webview는 회전을 감지하지 못하고 잘못된 방식으로 webview를 인쇄합니다.
YouTube 전체 화면이 내보기를 회전하기 위해 회전하는 것을 어떻게 감지 할 수 있습니까?
감사합니다.
Thnks 데 도움을줍니다
희망이지만도 아니고 정말 올바른. YouTube 전체 화면은 사용자가 비디오를 화면만큼 크게 만드는 두 개의 화살표를 누르면 나타납니다. 그런 다음이 전체 화면으로 회전하고 "완료"를 누르면 화면이 원래 방향으로 유지됩니다. viewWillAppear가 호출되지 않습니다. – ValentiGoClimb