Skip to content

Instantly share code, notes, and snippets.

@Bodacious
Created October 22, 2012 17:11
Show Gist options
  • Save Bodacious/3932629 to your computer and use it in GitHub Desktop.
Save Bodacious/3932629 to your computer and use it in GitHub Desktop.
Simple Rubymotion app with UIAlertView
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