Sha256: 67b645e71f3b2073e072998bb6b4c4985040d9f035e11cc4d18e803c58e0f6c1
Contents?: true
Size: 1.95 KB
Versions: 2
Compression:
Stored size: 1.95 KB
Contents
module BubbleWrap module App module_function # Opens an url (string or instance of `NSURL`) # in the device's web browser. # Usage Example: # App.open_url("http://matt.aimonetti.net") def open_url(url) unless url.is_a?(NSURL) url = NSURL.URLWithString(url) end UIApplication.sharedApplication.openURL(url) end # Displays a UIAlertView. # # title - The title as a String. # args - The title of the cancel button as a String, or a Hash of options. # (Default: { cancel_button_title: 'OK' }) # cancel_button_title - The title of the cancel button as a String. # message - The main message as a String. # block - Yields the alert object if a block is given, and does so before the alert is shown. # # Returns an instance of BW::UIAlertView def alert(title, *args, &block) options = { cancel_button_title: 'OK' } options.merge!(args.pop) if args.last.is_a?(Hash) if args.size > 0 && args.first.is_a?(String) options[:cancel_button_title] = args.shift end options[:title] = title options[:buttons] = options[:cancel_button_title] options[:cancel_button_index] = 0 # FIXME: alerts don't have "Cancel" buttons alert = UIAlertView.default(options) yield(alert) if block_given? alert.show alert end # Return application frame def frame UIScreen.mainScreen.applicationFrame end # Main Screen bounds. Useful when starting the app def bounds UIScreen.mainScreen.bounds end # Application Delegate def delegate UIApplication.sharedApplication.delegate end # the Application object. def shared UIApplication.sharedApplication end # the Application Window def window UIApplication.sharedApplication.keyWindow || UIApplication.sharedApplication.windows[0] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bubble-wrap-1.3.0 | motion/core/ios/app.rb |
bubble-wrap-1.3.0.osx | motion/core/ios/app.rb |