Skip to content

Instantly share code, notes, and snippets.

@masuidrive
Created May 2, 2012 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masuidrive/2577620 to your computer and use it in GitHub Desktop.
Save masuidrive/2577620 to your computer and use it in GitHub Desktop.
MobiRuby progress at May 3, 2012
# MobiRuby - May 3, 2012
#
# http://www.youtube.com/watch?v=fLB8iLSwup0
# http://mobiruby.org
class UIAlertView < Mobi::Cocoa::Object
end
class UIApplication < Mobi::Cocoa::Object
end
class NSURL < Mobi::Cocoa::Object
end
class MyAlertView < UIAlertView
define :void, :didPresentAlertView, :id do
p "MyAlertView::didPresentAlertView"
end
define :void, :alertView, :id, :clickedButtonAtIndex, :integer do |me, index|
if index == 1
app = UIApplication._sharedApplication
url = NSURL._URLWithString(_S("http://mobiruby.org"))
app._openURL url
end
end
end
class NSString < Mobi::Cocoa::Object
end
def _S(str)
NSString._stringWithUTF8String str
end
alert = MyAlertView._alloc.
_initWithTitle _S("Hello"),
:message, _S("I'm MobiRuby"),
:delegate, nil,
:cancelButtonTitle, _S("I know!"),
:otherButtonTitles, _S("What's?"), nil
alert._setDelegate alert
alert._show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment