-1
我在swift中使用多個segue,在tableView
中我有一個UIAlertView
。 UIAlertView
完美展現。當我點擊第一個選項(Ver Mapa)時,它完全改變爲另一個viewController
(Mapa)與segue(go_to_mapa
)。但是當我按賽格(go_to_detalle
)將第二個選項(Ver detalle)更改爲anotherViewController
時,它不起作用。不做任何事情。我該如何解決它?不能更改爲具有多個segue的另一個視圖控制器。我該如何解決它?
override func prepareForSegue(segue: (UIStoryboardSegue!), sender: AnyObject!) {
var refreshAlert = UIAlertController(title: "Menu", message: "Seleccione una opcion", preferredStyle: UIAlertControllerStyle.Alert)
refreshAlert.addAction(UIAlertAction(title: "Ver Mapa", style: .Default, handler: { (action: UIAlertAction!) in
if (segue.identifier == "go_to_mapa") {
var svc = segue!.destinationViewController as Mapa;
svc.cuenta = self.cuenta
svc.user = self.user
svc.password = self.password
let indexPath = self.tableView.indexPathForSelectedRow();
let currentCell = self.tableView.cellForRowAtIndexPath(indexPath!) as UITableViewCell!;
svc.Device = currentCell.detailTextLabel!.text!
svc.desc = currentCell.textLabel!.text!
self.navigationController?.pushViewController(svc, animated: false)
}
}))
refreshAlert.addAction(UIAlertAction(title: "Ver Vehiculo", style: .Default, handler: { (action: UIAlertAction!) in
if (segue.identifier == "go_to_detalle") {
let vc = segue.destinationViewController as Detalle_Vehiculo
}
}))
refreshAlert.addAction(UIAlertAction(title: "Ejecutar comandos", style: .Default, handler: { (action: UIAlertAction!) in
println("Ejecutar comandos")
}))
presentViewController(refreshAlert, animated: true, completion: nil)
}
它顯示在地圖上的viewController的錯誤,因爲我的一些數據傳遞到地圖view controller –
如果你刪除了所有實際導航到其他'otherviewcontroller'的代碼,怎麼會這樣呢?請確保您沒有'tableView:didSelectRowAtIndexPath:'也沒有'prepareForSegue:sender:'實現,並且在您點擊表格行時沒有任何反應。如果仍然發生,請刪除所有代碼 – Azat
我已經刪除了所有內容,但仍然沒有發生任何事情 –