Guest User

Untitled

a guest
Feb 20th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. # AppController.rb
  2. # test
  3. require 'osx/cocoa'
  4. OSX.ns_import :MyObject
  5.  
  6. class AppController < OSX::NSObject
  7. include OSX
  8.  
  9. def initialize
  10. @tester = MyObject.alloc.init;
  11. end
  12.  
  13. # Objective-Cのメソッドを呼び出し
  14. def doTest(sender)
  15. puts "doTest:"
  16. @tester.methodA_from(false, self)
  17. end
  18. ib_action :doTest
  19.  
  20. # Objective-C側から呼び出してもらうコールバックメソッド
  21. objc_method :callback, [:BOOL, :BOOL]
  22. def callback(para)
  23. puts "callback:"
  24. puts "para is #{para}"
  25. puts "callback return <false>"
  26. return false
  27. end
  28. end
Add Comment
Please, Sign In to add comment