2014-09-26 3 views
-1

В iOS 7, если я хочу получить событие UIWebView QuickTime «Готово».IOS 8 UIWebView MediaPlayer Сделано событие. Как я могу это получить?

Я могу использовать NSNotification, чтобы получить его.

Это мой код.

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(playerWillExitFullscreen:) 
              name:@"UIMoviePlayerControllerWillExitFullscreenNotification" 
              object:nil]; 
[_videoWebView loadRequest:[NSURLRequest requestWithURL:_contentURL]]; 

И использовать эту функцию, я могу получить Done event в UIWebView.

- (void)playerWillExitFullscreen:(NSNotification *)notification 

Но прошивка 8, уведомление не работает ... (Имя уведомления скрыто решение в прошивке 7.)

Так как я могу получить его (Готово событие) в iOS8?

ответ

-1

[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector (youTubeStarted :) имя: UIWindowDidBecomeVisibleNotification object: nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector (youTubeFinished :) name: UIWindowDidBecomeHiddenNotification object: nil];

- (Недействительными) youTubeStarted: (NSNotification *) уведомление { // Поступил Полноэкранный код здесь идет .. AppDelegate * AppDelegate = (AppDelegate *) [[UIApplication sharedApplication] делегат]; appDelegate.fullScreenVideoIsPlaying = YES; NSLog (@ "% f% f", webViewForWebSite.frame.origin.x, webViewForWebSite.frame.origin.y);

}

- (Недействительными) youTubeFinished: (NSNotification *) уведомление { // Левый весь экран код здесь идет ... AppDelegate * AppDelegate = (AppDelegate *) [[UIApplication sharedApplication] делегат]; appDelegate.fullScreenVideoIsPlaying = NO;

//CODE BELOW FORCES APP BACK TO PORTRAIT ORIENTATION ONCE YOU LEAVE VIDEO. 
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO]; 
//present/dismiss viewcontroller in order to activate rotating. 
UIViewController *mVC = [[UIViewController alloc] init]; 
[self presentViewController:mVC animated:NO completion:Nil]; 
// [self presentModalViewController:mVC animated:NO]; 
[self dismissViewControllerAnimated:NO completion:Nil]; 
// [self dismissModalViewControllerAnimated:NO]; 

}

 Смежные вопросы

  • Нет связанных вопросов^_^