我有 2 个 View Controller ,应该根据用户输入进行交换。因此,我想根据从文本文件中获得的输入以编程方式切换 View 。
Algorithm :
if(input == 1)
{
Go to View Controller 1
}
else if(input ==2)
{
Go to View Controller 2
}
有关如何以编程方式单击按钮或使用输入加载特定 View Controller 的任何帮助?
最佳答案
要以编程方式触发事件,您需要调用 sendActionsForControlEvent
button.sendActionsForControlEvents(.TouchUpInside)
--
swift 3
button.sendActions(for: .touchUpInside)
关于swift - 如何以编程方式单击按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39336562/