jdog
jdog

Reputation: 10779

UIButton is not receive touch events

I have a UIButton that is not receiving touch events. I think their might be a transparent view in the way. How can I detect what is being touched?

I think their is an app that allows me to turn my UI sideways while in the simulator, but i cannot remember the name of it. I would be willing to buy it.

Or is there a way to do this code?

Upvotes: 0

Views: 147

Answers (4)

Justin Holman
Justin Holman

Reputation: 852

Double check that Allow User Interaction is checked.

You could also delete the button, drag it back onto your view and hook up the methods.

Also make sure you are connected to the Touch Up Inside event and your method is an IBOutlet

- (IBAction) buttonPressed:(id)sender;

Upvotes: 1

Pawan Sharma
Pawan Sharma

Reputation: 3354

Have a look on DCIntrospect . It might solve your problem in. It's free to use and open source.

Upvotes: 0

Sport
Sport

Reputation: 8983

Allow user interaction like this:

yourButton.userInteractionEnabled = YES;

And if you add your button is on top of a UIImageView, then add this: yourImageView.userInteractionEnabled = YES;

Hope this will help you out.

Upvotes: 0

jdog
jdog

Reputation: 10779

The issue is that I did not set the width and height for autolayout so even though I saw the view, its height and width were 0,0.

Upvotes: 0

Related Questions