答案 0 :(得分:0)
解决方案是在按钮的NSViewController中触发segue覆盖shouldPerformSegue并在其中执行检查以确定是否应执行segue。
override func shouldPerformSegue(withIdentifier identifier: NSStoryboardSegue.Identifier, sender: Any?) -> Bool
{
var result = false
if identifier == "AddPayeeSegue"
{
if AccountingData.instance.book.account.count > 0
{
result = true
}
}
return result
}