简体   繁体   English

在UIButton中按下事件?

[英]pressing event in UIButton?

when i am pressing my UIButton ,( i did not release my mouse button ),i want to change title? 当我按下UIButton时,( 我没有释放鼠标键 ),我想更改标题吗? i tried touchupinside through XIB.but it was called after i released my mouse button. 我通过XIB尝试过touchupinside,但是在释放鼠标按钮后调用了它。 i tried both land also all states....? 我在所有州都尝试过这两个土地。 [sButton setTitle:@"hai" forState:UIControlStateNormal]; [sButton setTitle:@“ hai” forState:UIControlStateNormal]; [sButton setTitle:@"hai" forState:UIControlStateHighlighted]; [sButton setTitle:@“ hai” forState:UIControlStateHighlighted];

The Control Events documentation will list all of the events you can subscribe to for controls (in this case, your UIButton ). 控件事件文档将列出您可以为控件订阅的所有事件(在本例中为UIButton )。 The one you want is UIControlEventTouchDown . 您需要的是UIControlEventTouchDown But the problem with your requirement is that pushing the button covers the screen with the user's finger and I wonder whether changing the title will really be beneficial. 但是您要求的问题是,按下按钮时用户的手指会覆盖屏幕,我想知道更改标题是否真的有好处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM