ios - Fire UIPanGestureRecognizer with an outside starting point -
i have layout image below:
the black area camera, red area uiview uipangesturerecognizer , green area uicollectionview images.
right now, if user presses red area , starts dragging layout moved top , user able see more items in collection view @ once while camera overflows device screen. logic done.
my problem want same functionality if user starts dragging outside of red area, i.e. user starts dragging collection view bottom of device more items shown, if user reaches (crosses, moves over) red area, pangesturerecognizer should fired. instagram has functionality when selecting image disk. there way achieve missing? tried overriding red view pointinside, touchesbegan , touchesmoved, of called if drag comes collection view. swipegesture doesn't work either. thanks!
you try following:
1) add pangesture (the red one) want activated collection view too:
[self.collectionview addgesturerecognizer:redpangesture];
2) in method gets called when pangesture activated, filter logic gets executed when finger on top of red area:
cgpoint location = [recognizer locationinview:self.redview]; if(location.y > self.redview.frame.size.height) { [(uipangesturerecognizer *)recognizer settranslation:cgpointzero inview:self.view]; return; }
3) set class pangesture's delegate:
redpangesture.delegate = self;
4) implement method below, otherwise collection view not scroll:
- (bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldrecognizesimultaneouslywithgesturerecognizer:(uigesturerecognizer *)othergesturerecognizer { return yes; }
Comments
Post a Comment