我有兩個視圖控制器與自定義'推'segue在迅速。當我在桌面視圖中選擇一行時,它顯示完美的三個選項的警告框。我的問題是,當我選擇第一個選項(Ver Mapa)更改爲另一個視圖控制器時,它不起作用。不做任何事情。我該如何解決它?prepareForSegue不能快速工作。我該如何解決它?
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;
self.performSegueWithIdentifier("go_to_mapa", sender: self)
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!
}
}))
refreshAlert.addAction(UIAlertAction(title: "Detalle Vehiculo", style: .Default, handler: { (action: UIAlertAction!) in
println("Detalle Vehiculo")
}))
refreshAlert.addAction(UIAlertAction(title: "Ejecutar comandos", style: .Default, handler: { (action: UIAlertAction!) in
println("Ejecutar comandos")
}))
refreshAlert.addAction(UIAlertAction(title: "Cancelar", style: .Default, handler: { (action: UIAlertAction!) in
self.back()
}))
presentViewController(refreshAlert, animated: true, completion: nil)
}
沒有足夠的上下文來知道這些代碼去。如果您要發佈答案,請說明您放置該代碼的方法,以及何時調用該方法。基於你原來的問題中的混亂,我打賭你需要做出更多的改變。 –