Class: UnderOs::UI::Alert::CustomAlertView

Inherits:
UIAlertView
  • Object
show all
Defined in:
lib/under_os/ui/alert.rb

Instance Method Summary collapse

Instance Method Details

#alertView(alertView, willDismissWithButtonIndex: buttonIndex) ⇒ Object



47
48
49
50
# File 'lib/under_os/ui/alert.rb', line 47

def alertView(alertView, willDismissWithButtonIndex:buttonIndex)
  @wrapper.emit(:tap, buttonIndex: buttonIndex, buttonTitle: buttonTitleAtIndex(buttonIndex))
  @wrapper.emit(:close)
end

#initiWithOptions(wrapper, options) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/under_os/ui/alert.rb', line 31

def initiWithOptions(wrapper, options)
  @wrapper = wrapper

  initWithTitle(     options[:title]   || "",
            message: options[:message] || "No message given",
           delegate: self,
  cancelButtonTitle: options[:button]  || "Ok",
  otherButtonTitles: nil )

  (options[:buttons] || []).each do |title|
    addButtonWithTitle title
  end

  self
end