"완료"버튼을 누르지 않고도 스스로 해제 할 영화를 얻으려고합니다. 나는 튜토리얼을 정확히 따르고 NSLogs를 삽입 할 때 NSNotification과 removeFromSuperview가 인식되고 있지만 영화가 끝나면 그대로 남아 있기 때문에 최근 iOS 6 문제라고 생각합니다. 여기에 내 코드입니다, 도와주세요 :removeFromSuperview가 내 영화 하위보기를 제거하지 않는 이유는 무엇입니까? Xcode
- (IBAction)playMovie:(id)sender
{
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"RomneyFlipSequence1" ofType:@"mov"]];
_moviePlayer =
[[MPMoviePlayerController alloc]
initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:_moviePlayer];
_moviePlayer.controlStyle = MPMovieControlStyleDefault;
_moviePlayer.shouldAutoplay = YES;
[self.view addSubview:_moviePlayer.view];
[_moviePlayer setFullscreen:YES animated:NO];
}
- (void) moviePlayBackDidFinish:(NSNotification*)notification {
MPMoviePlayerController *player = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
if ([player
respondsToSelector:@selector(setFullscreen:animated:)])
{
[player.view removeFromSuperview];
}
}
@end
이 문제를 해결 했습니까? 동일한 문제가 있습니다. –
예, 전체 화면을 나가는 데는 문제가 있습니다. 이 줄을 추가해야합니다 : player.fullscreen = NO; [player.view removeFromSuperview]; – robertfiorentino