我遇到一个问题,即self.performSegueWithIdentifier("contact_segue", sender: self)
无效并抱怨接收方没有带标识符的segue' contact_segue' 即使我有标识符。我使用SWReveal框架来构建左侧滑动菜单,该菜单使用表视图(类:slidingMenuController)。单击单元格以调用MainNavigationController的函数changeView以执行更改视图。
import UIKit
class MainNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(animated: Bool){
super.viewDidAppear(false)
self.performSegueWithIdentifier("Home", sender: self)
}
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
if segue.identifier == "Contact_se" {
}
}
func changeView(){
self.performSegueWithIdentifier("contact_segue", sender: self)
}
}
由一个表格单元格中的左侧滑动菜单(class:slidingMenuController)调用的changeView:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let selectedItemMenu = arrayOfSlider[indexPath.row]
let mainNav = MainNavigationController()
mainNav.changeView()
}
答案 0 :(得分:2)
只需在didSelectRowAtIndexPath上添加此代码self.performSegueWithIdentifier("contact_segue", sender: self)
即可?我相信这里不需要MainNavigationController。