lib/ios/sugarcube-modal/modal.rb in sugarcube-2.9.1 vs lib/ios/sugarcube-modal/modal.rb in sugarcube-2.10.0
- old
+ new
@@ -2,9 +2,26 @@
module Modal
module_function
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
def present_modal_in_nav(view_ctlr, options={}, &block)
ctlr = UINavigationController.alloc.initWithRootViewController(view_ctlr)