Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone SDK - Touch a UIButton through a UILabel

I am trying to capture a touch through a UILabel, but am having trouble. Here is my scenario. I have a UIButton as a subview of a UIScrollView. I also have a UILabel as a subview of the same UIScrollView. The frame of the UILabel overlaps that of the UIButton, and thus (as far as I can tell) occludes the UIButton from being pressed.

I am trying to create a scenario where the user can touch through the UILabel (it has a transparent background, so the button is completely visible - less the labels text).

Is this possible?

I know touches behave differently when there is a UIScrollView involved. Is that impeding the touches?

Anyone have any advice? Cheers, Brett

like image 260
Brett Avatar asked Nov 30 '22 16:11

Brett


1 Answers

myLabel.userInteractionEnabled = NO;
like image 60
omz Avatar answered Dec 21 '22 05:12

omz