Suppose I have a button that everytime I clicked it will generate a random number of subviews. Is there anyway to detect the subview touched?
0
votes
1 Answers
0
votes
You can make use of touchesBegan method and use the view property of the UITouch instance passed:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
//use touch.view property to get the subview touched
}
Remember to set the property userInteractionEnabled to YES in each of your subviews.