я ставлю песни в таблицу, и когда я играю песню в детали страницы работы, и когда я вернусь стоп песню я хочу продолжить играть во всех видахкак сделать музыку Продолжить играть во всех видах
ViewController
if let audio=NSBundle.mainBundle().pathForResource(navigationItem.title , ofType: "mp3") {
let url=NSURL (fileURLWithPath: audio)
do {
player = try AVAudioPlayer (contentsOfURL: url)
}
catch{"erorr"}
player.play()
} else {
print("erorr")
}
tableViewController
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
self.performSegueWithIdentifier("indeaa", sender: tableView)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "indeaa" {
let vc = segue.destinationViewController as UIViewController
let indexpath:NSIndexPath = tableaa.indexPathForSelectedRow!
vc.title = arr[indexpath.row]
}
}
Чтобы уточнить, у вас есть View A, который выводит на просмотр B. View B воспроизводит звук, и когда вы переходите обратно в View A, звук останавливается. Это верно? – kpsharp
Да ........... –
Отметьте ответ @toast ниже. Это то, что вы хотите. – kpsharp