Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What should be paid attention to when developing drawings and gestures in App in ios

2025-02-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report