Swift 2中没有后退button
我更新了我的项目Swift 2.0。 当我从UITableViewController
移动到UIViewController
,导航项不显示返回button。 每个控制器都有UINavigationController,我使用show segue。
这个代码当我移动到其他控制器
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { tableView.selectRowAtIndexPath(indexPath, animated: true, scrollPosition: UITableViewScrollPosition.None) if searchPredicate == nil { performSegueWithIdentifier("listenMusic", sender: self) } else { performSegueWithIdentifier("oneSound", sender: self) } } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "listenMusic" { if (UIApplication.sharedApplication().delegate as! AppDelegate).mainAudioPlayer != nil { if (UIApplication.sharedApplication().delegate as! AppDelegate).mainAudioPlayer.playing { (UIApplication.sharedApplication().delegate as! AppDelegate).mainAudioPlayer.stop() } } let playerVC = (segue.destinationViewController as! UINavigationController).topViewController as! PlayMusicViewController // variant the second let curRow = tableView.indexPathForSelectedRow!.row playerVC.arrayOfMP3 = listOfMP3Files playerVC.currentRow = curRow // println(listOfMP3Files[curRow]) } else if segue.identifier == "oneSound" { if (UIApplication.sharedApplication().delegate as! AppDelegate).mainAudioPlayer != nil { if (UIApplication.sharedApplication().delegate as! AppDelegate).mainAudioPlayer.playing { (UIApplication.sharedApplication().delegate as! AppDelegate).mainAudioPlayer.stop() } } let playerFromOne = (segue.destinationViewController as! UINavigationController).topViewController as! PlayerFromOneTable let currentIndex = tableView.indexPathForSelectedRow!.row let currentTrackPass = arraySearchResults[currentIndex] // var currentIndexPath = tableView.indexPathForSelectedRow() playerFromOne.currentTrack = currentTrackPass // NSLog("Current track passs %@", currentTrackPass) } }
我创build了新的空项目,并从UIViewController
到第二个UIViewController
简单segue,我也得到了同样的结果。 我发现新的UIViewController
从底部出现而不是从右侧出现。