问题描述:

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.

相关阅读:
Top