Ios 播放完视频后,如何转到另一个ViewController?

Ios 播放完视频后,如何转到另一个ViewController?,ios,objective-c,Ios,Objective C,播放完视频后,如何转到另一个ViewController?从“2”到“1”(查看屏幕截图) viewdiload(videoViewControler)中的代码: 为MPMoviePlayerPlaybackDidFinishNotification添加一个观测者,该观测者将在电影结束时通知您,然后您可以重新弹出视图控制器 [[NSNotificationCenter defaultCenter] addObserver:self

播放完视频后,如何转到另一个ViewController?从“2”到“1”(查看屏幕截图)

viewdiloadvideoViewControler)中的代码:


为MPMoviePlayerPlaybackDidFinishNotification添加一个观测者,该观测者将在电影结束时通知您,然后您可以重新弹出视图控制器

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(movieFinished:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:_moviePlayer];

您必须注册did完成通知,例如在viewDidLoad中:

// Register for finished notification
[[NSNotificationCenter defaultCenter] addObserver:self 
    selector:@selector(moveToView2:)
    name:MPMoviePlayerPlaybackDidFinishNotification
    object:self.moviePlayerViewController.moviePlayer];
添加通知方法并调用segue转到其他视图:

- (void) moveToView2:(NSNotification *) notification {
    [self performSegueWithIdentifier:@"IDENTIFIER" sender:self];
}
只需确保将标识符替换为视图A和B之间的序列标识符

- (void) moveToView2:(NSNotification *) notification {
    [self performSegueWithIdentifier:@"IDENTIFIER" sender:self];
}