how to programmatically fake a touch event to a UIButton?

后端 未结 8 1904
余生分开走
余生分开走 2020-11-29 15:48

I\'m writing some unit tests and, because of the nature of this particular app, it\'s important that I get as high up the UI chain as possible. So, what I\'d l

8条回答
  •  感情败类
    2020-11-29 16:21

    An update to this answer for Swift

    buttonObj.sendActionsForControlEvents(.TouchUpInside)
    

    EDIT: Updated for Swift 3

    buttonObj.sendActions(for: .touchUpInside)
    

提交回复
热议问题