Programmatically fire button click event?

后端 未结 5 1208
后悔当初
后悔当初 2020-12-04 07:36

Is there a way to programmatically fire a button click event? I have a button placed there in an UIView, and in a particular scenario i want to click the button via code, no

5条回答
  •  北海茫月
    2020-12-04 08:12

    Sort of like Ken's answer, but more flexible as it'll keep track of the buttons actual actions if you change them or add more than one.

    [button sendActionsForControlEvents:UIControlEventTouchUpInside];
    

提交回复
热议问题