I create a random number of custom UIViews of the same class, and I add them to the UIViewController view. I assign them a UITapGestureRecognizer, but I seem to be unable to make an exclusive contact:
for (int i = 0; i <= n; i++) { ICCatalogProductView *catalogProductView; catalogProductView = [[ICCatalogProductView alloc] init]; [self.view addSubview:catalogProductView] UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(testTouch)]; [catalogProductView addGestureRecognizer:tapGesture]; [catalogProductView setExclusiveTouch:YES]; }
If I press UIViews at the same time, the method is called twice (not what I want). Is there any elegant way to solve this or any method in general?
source share