Created
May 2, 2012 15:42
-
-
Save masuidrive/2577620 to your computer and use it in GitHub Desktop.
MobiRuby progress at May 3, 2012
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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