Created
October 22, 2012 17:11
-
-
Save Bodacious/3932629 to your computer and use it in GitHub Desktop.
Simple Rubymotion app with UIAlertView
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
class MyController < UIViewController | |
def viewDidLoad | |
self.view.backgroundColor = UIColor.whiteColor | |
alert.show | |
end | |
# ============== | |
# = Properties = | |
# ============== | |
def alert | |
@alert ||= UIAlertView.alloc.initWithTitle("Alert Title", message: "This is the message", delegate: self, cancelButtonTitle: "Back", otherButtonTitles: "OK") | |
end | |
# ======================= | |
# = UIAlertViewDelegate = | |
# ======================= | |
def alertView(alertView, clickedButtonAtIndex: indexPath) | |
# do nothing... | |
end | |
end | |
class AppDelegate | |
def window | |
@window ||= UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) | |
end | |
def controller | |
@controller ||= MyController.new | |
end | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
window.rootViewController = controller | |
window.makeKeyAndVisible | |
true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment