新聞中心
這篇文章給大家分享的是有關(guān)ios中App開發(fā)繪圖、手勢需要注意什么的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。
成都創(chuàng)新互聯(lián)公司是一家專業(yè)提供堯都企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計(jì)制作、網(wǎng)站設(shè)計(jì)、H5高端網(wǎng)站建設(shè)、小程序制作等業(yè)務(wù)。10年已為堯都眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。
手勢的一些注意事項(xiàng)
對于 UITapGestureRecognizer 來說我們一般需要知道該點(diǎn)擊手勢在屏幕中的位置 (locationInView:self)
對于 UIPanGestureRecognizer 來說我們一般需要知道我們的滑動手勢移動了多少距離 (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); //復(fù)位 [pan setTranslation: CGPointZero inView: 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]; } } ];
接下來來一個(gè)iOS圖形繪制、旋轉(zhuǎn)、長按、縮放、滑動等綜合手勢的一個(gè) 畫圖 項(xiàng)目
感謝各位的閱讀!關(guān)于“ios中App開發(fā)繪圖、手勢需要注意什么”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
網(wǎng)頁題目:ios中App開發(fā)繪圖、手勢需要注意什么
標(biāo)題URL:http://ef60e0e.cn/article/pddphc.html