У меня возникла проблема с поворотным видео youtube. Я добавил следующий код в свое приложение. И это работает для iOS 7. Однако это не для iOS8.Поворот видео youtube с iOS8
На моем взгляде, контроллер, я использовал следующий код:
if(IS_OS_6_OR_LATER){
// I use the following notification for iOS 7
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeStarted:) latername:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];//Notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeFinished:) name:@"UIMoviePlayerControllerWillExitFullscreenNotification" object:nil];//Notification
}
if (IS_OS_8_OR_LATER) {
// I use the following notification for iOS 8
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeStarted:) name:UIWindowDidBecomeVisibleNotification object:self.view.window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeFinished:) name:UIWindowDidBecomeHiddenNotification object:self.view.window];
}
-(void) youTubeStarted:(NSNotification*) notif {
//Handle event
AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
appDelegate.fullScreenVideoIsPlaying = YES;
NSLog(@"start fullscreen");
}
-(void) youTubeFinished:(NSNotification*) notif {
AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];//Notification
appDelegate.fullScreenVideoIsPlaying = NO;//Notification
NSLog(@"exit fullscreen");//Notification
}
-(BOOL) shouldAutorotate {
//Handle rotate
NSLog(@"AutoState");
return NO;
}
-(NSUInteger)supportedInterfaceOrientations{
//Handle rotate
NSLog(@"AutoState 1");
return UIInterfaceOrientationMaskPortrait;//Notification
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
//Handle rotate
NSLog(@"AutoState 2");
return UIInterfaceOrientationPortrait;//Notification
}
В прошивке 7, когда видео воспроизводится в ландшафтном режиме, я нажмите кнопку Готова, я вижу, журнал «AutoState 1» показан, однако я не видите этот журнал при работе с iOS 8. Можете ли вы помочь мне решить эту проблему на iOS 8? Большое спасибо
Для правильного форматирования кода требуется время, чтобы его было легче читать. Предоставьте больше информации о вашей проблеме и ее контексте. – gareththegeek
@gareththegeek: Извините, потому что я новичок. Мне очень жаль об этом – duy
Кто может мне помочь? Пожалуйста!!!!!!! – duy