module SugarCube::Modal
Public Instance Methods
dismiss_modal(options={}, &block)
click to toggle source
# File lib/ios/sugarcube-modal/modal.rb, line 35 def dismiss_modal(options={}, &block) target = options.fetch(:target, UIApplication.sharedApplication.keyWindow.rootViewController) animated = options.fetch(:animated, true) target.dismissViewControllerAnimated(animated, completion:block) end
present_modal(view_ctlr, options={}, &block)
click to toggle source
# File lib/ios/sugarcube-modal/modal.rb, line 4 def present_modal(view_ctlr, options={}, &block) target = options[:target] || UIApplication.sharedApplication.keyWindow.rootViewController animated = options.fetch(:animated, true) presentation_style = options[:presentation] if presentation_style if presentation_style.respond_to?(:presentationstyle) presentation_style = presentation_style.presentationstyle end view_ctlr.modalPresentationStyle = presentation_style end transition_style = options[:transition] if transition_style if transition_style.respond_to?(:transitionstyle) transition_style = transition_style.transitionstyle end view_ctlr.modalTransitionStyle = transition_style end target.presentViewController(view_ctlr, animated:animated, completion:block) end