Class: UnderOs::UI::Alert

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

Defined Under Namespace

Classes: CustomAlertView

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Alert

Returns a new instance of Alert.



4
5
6
7
8
9
10
# File 'lib/under_os/ui/alert.rb', line 4

def initialize(options={})
  options = {message: options}  if options.is_a?(String)
  self.on = options.delete[:on] if options[:on]

  @_ = CustomAlertView.alloc.initiWithOptions(self, options)
  @_.show unless options[:show] == false
end

Instance Method Details

#hiddenObject



26
27
28
# File 'lib/under_os/ui/alert.rb', line 26

def hidden
  !visible
end

#hide(animated = true) ⇒ Object



17
18
19
20
# File 'lib/under_os/ui/alert.rb', line 17

def hide(animated=true)
  @_.dismissWithClickedButtonIndex(0, animated: animated)
  self
end

#showObject



12
13
14
15
# File 'lib/under_os/ui/alert.rb', line 12

def show
  @_.show
  self
end

#visibleObject



22
23
24
# File 'lib/under_os/ui/alert.rb', line 22

def visible
  @_.visible
end