Sha256: f02f0aa81e84c74de5508f1bc1ec5950fa2f6379da96cbc2147f6e998a2d2eee
Contents?: true
Size: 1.39 KB
Versions: 22
Compression:
Stored size: 1.39 KB
Contents
module SugarCube module Modal module_function def present_modal(view_ctlr, options={}, &block) target = options[:target] || UIApplication.sharedApplication.keyWindow.rootViewController animated = options.fetch(:animated, true) target.presentViewController(view_ctlr, animated:animated, completion:block) end def present_modal_in_nav(view_ctlr, options={}, &block) ctlr = UINavigationController.alloc.initWithRootViewController(view_ctlr) ctlr.modalTransitionStyle = UIModalTransitionStyleCoverVertical SugarCube::Modal.present_modal(ctlr, options, &block) ctlr end def dismiss_modal(options={}, &block) target = options.fetch(:target, UIApplication.sharedApplication.keyWindow.rootViewController) animated = options.fetch(:animated, true) target.dismissViewControllerAnimated(animated, completion:block) end end end class UIViewController def present_modal(view_ctlr, options={}, &block) options = options.merge(target: self) SugarCube::Modal.present_modal(view_ctlr, options, &block) end def present_modal_in_nav(view_ctlr, options={}, &block) options = options.merge(target: self) SugarCube::Modal.present_modal_in_nav(view_ctlr, options, &block) end def dismiss_modal(options={}, &block) options = options.merge(target: self) SugarCube::Modal.dismiss_modal(options, &block) end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
sugarcube-2.0.1 | lib/ios/sugarcube-modal/modal.rb |
sugarcube-2.0.0 | lib/ios/sugarcube-modal/modal.rb |