kol*_*rie 20 syntax objective-c rubymotion
如何将以下方法调用从ObjectiveC转换为RubyMotion语法:
[self.faceView addGestureRecognizer:[
[UIPinchGestureRecognizer alloc] initWithTarget:self.faceView
action:@selector(pinch:)]];
Run Code Online (Sandbox Code Playgroud)
我到目前为止:
self.faceView.addGestureRecognizer(
UIPinchGestureRecognizer.alloc.initWithTarget(
self.faceView, action:???))
Run Code Online (Sandbox Code Playgroud)
我理解@selector(pinch:)指示接收器对象pinch方法的委托,但我如何在RubyMotion中执行此操作?也许用块?
Dyl*_*kow 26
您应该只能使用字符串来指定选择器:
self.faceView.addGestureRecognizer(
UIPinchGestureRecognizer.alloc.initWithTarget(
self.faceView, action:'pinch'))
Run Code Online (Sandbox Code Playgroud)