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
How Reliable Is Kvo with Uikit
How to Use Unsafemutablepointer in Swift 3
How to Set an Nscalendarunitminute Repeatinterval on iOS 10 Usernotifications
Uiscrollview Pauses Nstimer While Scrolling
Swift JSON Error:Could Not Cast Value of Type '_Nsdictionarym' to 'Nsarray'
Swift - Tableview Row Height Updates Only After Scrolling or Toggle Expand/Collapse
Fetching Selected Attribute in Entities
Set Text Color and Font for Uidatepicker in iOS8/Swift
Done Button Click Event in Avplayerviewcontroller
Block_Release Deallocating UI Objects on a Background Thread
Customize Apps Gallery in Appstore Page
Ipa Generated by Swift Is So Big, About 5Mb
How to Change the Color of Uipickerview Selector
Autolayout Views Make App Crash on Popviewcontroller