如何使用Swift模拟View中的按钮按下.我正在尝试获取日历权限并设置功能以在我单击当前运行的开始按钮时检查此授权
@IBAction func start(sender: AnyObject) {
//loads prompt to "Allow" or "Don't Allow" calendar permissions
eventStore.requestAccessToEntityType(EKEntityTypeEvent, completion: handler)
//checkAuth function looks at calendar authorization to get current status
and then acts accordingly to dismiss View or load Privacy Settings
checkAuth()
}
Run Code Online (Sandbox Code Playgroud)
我需要能够模拟按下"开始"按钮的按钮再次触发start()func.到目前为止,我发现的唯一一件事似乎是在Objective-C中
[buttonObj sendActionsForControlEvents: UIControlEventTouchUpInside];
我不熟悉Obj-C,如果可能的话,需要一种在Swift中实现它的方法......谢谢