class CustomSegue: UIStoryboardSegue {
override init(identifier: String?, source: UIViewController, destination: UIViewController) {
super.init(identifier: identifier, source: source, destination: destination)
}
override func perform() {
self.source.navigationController?.pushViewController(self.destination, animated: true)
}
}在上面的代码中,我将重写segue的行为。只有在其他类型为pushViewController显示(例如: Push)的情况下,它才应该使用,它应该执行它能够执行的默认行为。
如何在子类Kind方法中找到segue的Kind?
i.e
override func perform() {
if kind==Push {
self.source.navigationController?.pushViewController(self.destination, animated: true)
} else {
super.perform()
}
}发布于 2017-01-01 08:40:04
在故事板中,选择segue作为自定义segue,选择select作为自定义segue,对于默认行为,只需选择show segue (例如push)。

https://stackoverflow.com/questions/41410957
复制相似问题