当 Mpmovieplaertsontroller 进入全屏模式时,它会创建一个附加窗口(通常是应用程序窗口列表中的最后一个)。由此我们可以测试所有可能的视图和子视图并找到必要的控件。然后你可以把你需要的一切。例如,如何向 MPMoviePlayer 添加滑动。
- (void)didEnterFullScreen:(NSNotification*)notification {
[NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(showFullScreenControls) userInfo:nil repeats:NO];
}
- (void)showFullScreenControls {
NSArray *windows = [[UIApplication sharedApplication] windows];
UIWindow* mpfullscreenwindow = [windows lastObject];
gestureView = mpfullscreenwindow.subviews[0];
testbutton = [UIButton buttonWithType:UIButtonTypeSystem];
[testbutton setTitle:@"Test" forState:UIControlStateNormal];
testbutton.frame = CGRectMake(10, 50, 100, 50);
testbutton.backgroundColor = [UIColor greenColor];
[testbutton addTarget:self action:@selector(alertBtnAction) forControlEvents: UIControlEventTouchUpInside];
[mpfullscreenwindow addSubview:testbutton];
[gestureView addGestureRecognizer:_leftSwipeRecognizer];
[gestureView addGestureRecognizer:_rightSwipeRecognizer];
}