Class: Tgios::BindingBase

Inherits:
Object
  • Object
show all
Defined in:
lib/tgios/binding_base.rb

Instance Method Summary collapse

Constructor Details

#initialize(*arg) ⇒ BindingBase

Returns a new instance of BindingBase.



3
4
5
# File 'lib/tgios/binding_base.rb', line 3

def initialize(*arg)
  @hook_bindings = []
end

Instance Method Details

#deallocObject



32
33
34
35
# File 'lib/tgios/binding_base.rb', line 32

def dealloc
  ap "#{self.class.name} dealloc"
  super
end

#hook(control, event, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/tgios/binding_base.rb', line 16

def hook(control, event, &block)
  binding=if control.is_a?(UIButton)
            UIButtonBinding.new.bind(control).on(event, &block)
          end

  @hook_bindings << binding
  binding

end

#onPrepareForReleaseObject

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/tgios/binding_base.rb', line 12

def onPrepareForRelease
  raise NotImplementedError.new("prepareForRelease not overridden for class #{self.class.name}")
end

#prepareForReleaseObject



7
8
9
10
# File 'lib/tgios/binding_base.rb', line 7

def prepareForRelease
  @hook_bindings = nil
  onPrepareForRelease
end

#unhook(control, event) ⇒ Object



26
27
28
29
30
# File 'lib/tgios/binding_base.rb', line 26

def unhook(control, event)
  if control.is_a?(UIButton)
    UIButtonBinding.unbind(control)
  end
end