Class: Nitron::UI::DataBinder

Inherits:
Object
  • Object
show all
Defined in:
lib/nitron/ui/data_binder.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.sharedObject



4
5
6
# File 'lib/nitron/ui/data_binder.rb', line 4

def self.shared
  @singleton ||= alloc.init
end

Instance Method Details

#bind(model, view, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/nitron/ui/data_binder.rb', line 8

def bind(model, view, options={})
  if view.is_a?(UITableView)
    view.delegate = DataBoundTableDelegate.alloc.initWithDelegate(view.delegate)
    return [view.delegate]
  end

  view.dataBindings.each do |keyPath, subview|
    bindControl(model, subview, keyPath)
  end

  nil
end