Reputation: 6803
I have a really strange problem. I have a UIView and on that view I have 3 UIButtons.
the UIView has a frame
CGRectMake(0, 0, 320, 300)
and I put the buttons on the frame one next to the other with height 50 pixels on the bottom part of the UIView but still within it.
For some reason the UIButtons don't receive the touch but if I raise their height they do... what could be the cause of this strange problem?
Upvotes: 1
Views: 1007
Reputation: 2426
Try changing CGRectMake(0, 0, 320, 300) to CGRectMake(0, 100, 320, 300) or similar to move the view down the page and compare the behaviour with moving the buttons inside the view.
Does this have the same effect as moving the buttons?
This should help you work out if the problem is within this view, or outside of it.
Upvotes: 0
Reputation: 23359
You may also look into the frame size of the UIButton's
parent view. when I started out I often overlooked this and actually what happened is the button is not completely inside the parent. But due to the fact the parent view is not clipping that view I could see it... but not interact with part or all of it.
Upvotes: 0
Reputation: 1164
maybe there is a component at the same place with the button with a different zindex
try this mothode to bring your btn to front
[yourView bringSubviewToFront:yourButton]
Upvotes: 2