当前位置: 动力学知识库 > 问答 > 编程问答 >

Button down/up in objective c for iphone?

问题描述:

I have a button, and I'd like to call a function when the user pushes it then call a different function when he releases it.

Right now I'm using this to create the button:

[ScanButton addTarget:self action:@selector(scanButtonPressed)

forControlEvents:UIControlEventTouchUpInside];

to call scanButtonPressed. As of now scanButtonPressed is only called upon release. How do I change this?

Thanks

网友答案:

How about by trying a control event other than UIControlEventTouchUpInside?

网友答案:

Try - UIControlEventTouchDown .

网友答案:

This contains all of the different events you can pass to a button UIControl Class Reference. Try looking at these; both UIControlEventTouchUpInside and UIControlEventTouchDown will work.

分享给朋友:
您可能感兴趣的文章:
随机阅读: