IPhone UIControl and Subview

I currently have UIControl which has several subzones (image, label).

Unfortunately, when I use addTarget etc. It does not detect touches in subzones.

  [myCustomView addTarget:self action:@selector(touchedView:)
             forControlEvents:UIControlEventTouchUpInside];

Is it possible for UIControl to detect touches on the subzones or should I approach it differently.

+3
source share
3 answers

Just note that all UIControl routines that should not receive touch events themselves should have a userInteractionEnabled value of NO , not YES (this is the default value).

Therefore, you must set this on all labels, images, etc.

:)

+21

.

myCustomView .

0
[myCustomView setUserInteractionEnabled:YES];
0
source

Source: https://habr.com/ru/post/1744276/


All Articles