0
我努力學習斯威夫特,這有我真的很困惑:斯威夫特UIGestureRecognizer符號
說你加入了手勢:
faceView.addGestureRecognizer(UIPinchGestureRecognizer(target: faceView, action: "scale:"))
這是尺度函數:
func scale(gesture: UIPinchGestureRecognizer) {
if gesture.state == .Changed {
scale *= gesture.scale
gesture.scale = 1
}
}
爲什麼在縮放結束時會出現冒號(例如:「scale:」)?是否要引用scale函數接受UIPinchGestureRecognizer類型的參數這一事實?
如果是,那麼冒號是如何表示該參數的?
可能重複[@selector()在Swift?](http://stackoverflow.com/questions/24007650/selector-in-swift) –
@RashwanL would'nt重複,但非常相關。還相關:[何時使用冒號與選擇器](http://stackoverflow.com/questions/4953623/when-to-use-a-colon-with-a-selector) – tskulbru