What should be paid attention to when developing drawings and gestures in App in ios
This article shares with you what you need to pay attention to when developing graphics and gestures in iOS. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
Some notes on gestures
For UNITapGestureRecognizer we generally need to know the location of the tap gesture on the screen (locationInView:self)
For UIPanGestureRecognizer we generally need to know how far our swipe gesture has moved (translationInView:pan)
-(void) pan:(UIPanGestureRecognizer * ) pan { CGPoint transP = [pan translationInView: pan.view]; //$1 =(x = 0.73990527317289434, y = 0) CGPoint pont1 = [pan locationInView: self];//$2 =(x = 198.16665649414063, y = 342.33332824707031) CGPoint pont2 = [pan locationInView: self.imageV];//$3 = (x = 198.12057060663793, y = 342.61609831987914) pan.view.transform = CGAffineTransformTranslate(pan.view.transform, transP.x, transP.y); //Multiposition [pan setTranslation: CGZero PointinView: pan.view];}[UIView animateWithDuration: 0.25 animations: ^ { self.imageView.alpha = 0; }completion: ^ (BOOL finished){ self.imageView.alpha = 1; UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0); CGContextRef ctx = UIGraphicsGetCurrentContext(); [self.layer renderInContext: ctx]; UIImage * imageGot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); [self.imageView removeFromSuperview]; if (self.delegate && [self.delegate respondsToSelector: @selector(handleImageView: didOperatedImage: )]){ [self.delegate handleImageView: self didOperatedImage: imageGot]; } }];
Next, come to an iOS graphics drawing, rotation, long press, zoom, slide and other comprehensive gestures of a drawing project
Thank you for reading! About "ios App development drawing, gestures need to pay attention to what" this article is shared here, I hope the above content can have some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!