Search code examples
iosiphoneibactionuiprogressview

linking UIProgressView with IBAction


Perhaps I'm missing something here, but I want the user to be able to select a UIProgressView and thus have an IBAction function call (essentially make it behave like a UIButton).

This can't be rocket science, but I can't figure it out.

BTW, I have xCode 4.


Solution

  • Add a gesture recognizer. With UITapGestureRecognizer you can make any UIView (or subclass) instance respond to taps. You'll have to do it in code instead of in IB, which means you'll need an IBOutlet connection to the progress view. You might need to set userInteractionEnabled to YES to make it work.

    It's kind of hard to imagine a scenario where this makes sense, but I'll just assume you have a good reason and leave it at that.