如果我有一个设置了目标的 UIButton,是否可以在不显式调用的情况下调用此方法?
例如:
[newViewController.button addTarget:self action:@selector(MyMethod) forControlEvents:UIControlEventTouchUpInside];
然后我想在 newViewController
中调用此方法,但不能,因为 MyMethod
属于父 View 。所以我真的很想说,只需调用 UIButton 按钮上的方法/目标即可。但是我该怎么做呢?
谢谢
最佳答案
刚刚发现如何做到这一点。非常简单,感觉就像一个菜鸟现在问!
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
关于iphone - 在 UIButton 上设置为目标的调用方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4261798/