Done Button Click Event in Avplayerviewcontroller

How to adding done button in AVPlayerViewController?

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self
action:@selector(aMethod:)
forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"Done" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); // set your own position
[view addSubview:button]; // or you can add [playerViewController.view addSubview:button];

-(void)aMethod:(UIButton *)button {

// Remove playerViewController.view
}

No Done button on AVPlayerViewController

Yes, the 'Done' button acts as a dismissal for a modal presentation style. If you are pushing the AVPlayerViewController onto the navigation stack you will need to handle the popping yourself.

Swift AVPlayer has no done button

"Done" button is present and working if doing this way:

    let playerVC = AVPlayerViewController()
playerVC.player = AVPlayer(URL: NSURL(string: "http://www.ebookfrenzy.com/ios_book/movie/movie.mov")!)
self.presentViewController(playerVC, animated: true, completion: nil)

Swift 3:

self.showDetailViewController(playerVC, sender: self) 
// presentViewController is deprecated


Related Topics



Leave a reply



Submit