class SugarCube::ActionSheetDelegate
Attributes
on_cancel[RW]
on_default[RW]
on_destructive[RW]
on_success[RW]
Public Instance Methods
actionSheet(alert, didDismissWithButtonIndex: index)
click to toggle source
# File lib/ios/sugarcube-factories/uiactionsheet.rb, line 160 def actionSheet(alert, didDismissWithButtonIndex: index) handler = nil if index == alert.destructiveButtonIndex && on_destructive handler = on_destructive elsif index == alert.cancelButtonIndex && on_cancel handler = on_cancel elsif index != alert.destructiveButtonIndex && index != alert.cancelButtonIndex && on_success handler = on_success end handler ||= on_default if handler if handler.arity == 0 handler.call else button = buttons[index] if handler.arity == 1 handler.call(button) else handler.call(button, index) end end end self.send(:autorelease) end