ios - 创建一个 ios 绘画应用程序
<p><p>我正在尝试创建一个简单的绘画应用程序。</p>
<pre><code>- (void)handleSingleTap:(UIPanGestureRecognizer *)recognizer
{
CGPoint location = ];
NSLog(@"Test");
CGFloat ok = 40;
self.sheet.test = ok;
;
//Do stuff here...
}
</code></pre>
<p>这个函数画线但是当我抬起手指并替换它时,从最后一个点到下一个点有一条“直线”。我怎样才能跳过这个?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>尝试使用 UIGestureRecognizerStateEnded 控制它</p>
<pre><code>if(recognizer.state == UIGestureRecognizerStateEnded){
//Drawing Ends.
isDrawn = NO;
}
</code></pre>
<p>根据您的评论,我了解到您正在使用变量 isDrawn 控制您的线条绘制方法。</p>
<pre><code> if(recognier.state == UIGestureStateBegan){
; // declare the point variable in the header file.
isDrawn = YES;
//Drawing Starts
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 创建一个 ios 绘画应用程序,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/47067698/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/47067698/
</a>
</p>
页:
[1]