0
我一个UITableView有两列:文本colomn和左边的textColumn图像通话标准SEGUE通过点击一个按钮
,我使用的是standarard SEGUE,everytehing是精...
现在我要实现的同样的动作,当右侧按钮被窃听
我有一个新的赛格瑞imageDisplay试过的权利(图)列
let tapRecognizerImage = UITapGestureRecognizer(target: self, action: Selector("imageAction:"))
cell.imageButton.addGestureRecognizer(tapRecognizerImage)
}
func imageAction(sender: UITapGestureRecognizer) {
performSegueWithIdentifier("imageDisplay", sender: self)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showDetail" {
let indexPath:NSIndexPath = self.tableView.indexPathForSelectedRow!
let controller = segue.destinationViewController as! DetailViewController
controller.kategorie = self.fetchedResultsController.objectAtIndexPath(indexPath) as! Kategorien
} else if segue.identifier == "imageDisplay" {
let indexPath : NSIndexPath = self.tableView.indexPathForSelectedRow!
let controller = segue.destinationViewController as! DetailViewController
controller.kategorie = self.fetchedResultsController.objectAtIndexPath(indexPath) as! Kategorien
}
}
现在
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
我得到的错误
致命错误:意外发现零而展开的可选值
这是,导致self.tableView.indexPathForSelectedRow!是零!
也许,有一种更简单的方法来解决这个问题?
这就是亚历山大!谢谢!!! –