i have a question about the "Done"-Button in iOS Player, is it possible to use the Done-Button as a Exit or Close Button for Apps coded with Swift?
App that i want to build is a Standalone App with only one video, when i click the App Button on the Homescreen, it have to open and play the video, if i click on "Done" in the Top-Left Corner it have to be closed.
My Code is:
import UIKit
import AVKit
import AVFoundation
class ViewController: UIViewController {
var playerViewController = AVPlayerViewController()
var playerView = AVPlayer()
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(animated: Bool) {
let fileURL = NSBundle.mainBundle().pathForResource("Befeuchtungsstrecke", ofType: "mp4")
playerView = AVPlayer(URL: NSURL(fileURLWithPath: fileURL!))
playerViewController.player = playerView
self.presentViewController(playerViewController, animated: true){
self.playerViewController.player?.play()
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
EDIT: sorry i don't know that apple don't want to close a App manuell. Ok then, i want to solve the problem in another way.
I have two ViewController in the first one (ViewConrtoller1) there is a Button where you can go to the second view (ViewConrtoller2). In the Second there is a video with all Controller (Play, Pause, Back, Forward etc.) and also have the "Done" Button on Top-Left Corner.
How can i get back (ViewController2 --> ViewController1) to the first by using "Done" Button? Is that possible?
Thanks :)