我只是好奇我将如何处理这个问题.如果我有一个函数,并且我想在完全执行时发生某些事情,我该如何将它添加到函数中?谢谢
我试图让这个绘制一条平移手势发生的线.问题是当我尝试使用此代码时
var firstPoint: CGPoint!
var path: UIBezierPath!
@IBAction func panned(gesture: UIPanGestureRecognizer) {
switch gesture.state {
case .Began: firstPoint = gesture.locationOfTouch(0, inView: view)
case .Ended: gesture.cancelsTouchesInView = true
case .Changed:
path.moveToPoint(firstPoint)
path.addLineToPoint(gesture.translationInView(view))
path.stroke()
default: break
}
}
Run Code Online (Sandbox Code Playgroud)
...我得到了多个错误,我不太清楚该怎么做.
Apr 2 17:40:03 MacBook-Pro.local Paint[6729] <Error>: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is …Run Code Online (Sandbox Code Playgroud)