I have a view on that added a UITextView
. I have added a UIgestureRecognizer
on main view if i move the main view it's move with UItextView
but if I moved from UItextView view then main view is not moving along that.
Tried:- By doing UITextView
userInteractionEnabled
disable then it's work but I should make it active when there is no drag.
Used PanGestureReconizer
and handle
-(void)handleResizePanGesture:(UIPanGestureRecognizer*)p {
if (p.state ==UIGestureRecognizerStateBegan) {
touchStart = [p translationInView:self];
touchStart = CGPointMake(touchStart.x - self.bounds.size.width,
touchStart.y - self.bounds.size.height);
}
if (p.state == UIGestureRecognizerStateChanged) {
touchPoint = [p translationInView:self];
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y,
touchPoint.x - touchStart.x, touchPoint.y - touchStart.y);
UITextView *textV = (UITextView*)[self viewWithTag:100];
textV.frame = CGRectMake(self.bounds.origin.x+HotCornerHeight/2, self.bounds.origin.y+HotCornerHeight/2,
touchPoint.x - touchStart.x-HotCornerHeight, touchPoint.y - touchStart.y-HotCornerHeight);
UIButton *resButton = (UIButton*)[self viewWithTag:102];
resButton.frame = CGRectMake(self.bounds.size.width-resizeButton,self.bounds.size.height-resizeButton, resizeButton,resizeButton);
}
if (p.state ==UIGestureRecognizerStateEnded || p.state ==UIGestureRecognizerStateEnded) {
return;
}
}
'
Hope this will save some time in future for others.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.