ios - Set exclusive touch on multiple UIViews of the same class -
i creating random number of custom uiviews of same class, , i'm adding them in uiviewcontroller's view. i'm assigning them uitapgesturerecognizer, can't seem make exclusive touch work:
for (int = 0; <= 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 tap uiviews simultanously, method called twice (not behaviour want). there elegant method of solving this, or method @ all?
from apple documentation:
exclusivetouch prevents touches in other views during time in there's active touch in exclusive touch view. is, if put finger down in exclusive touch view touches won't start in other views until lift first finger. not prevent touches starting in other views if there no touches in exclusivetouch view.
to make view thing on screen can receive touches you'd need either add view on top of else catch rest of touches, or subclass view somewhere in hierarchy (or uiwindow itself) , override hittest:withevent: return text view when it's visible, or return nil touches not in text view.
means set exclusive in 1 view, not if touching outside view.
Comments
Post a Comment