Class: SimpleViewController

Inherits:
UIViewController
  • Object
show all
Includes:
SimpleView::Layout
Defined in:
app/simple_view_controller.rb

Constant Summary collapse

DEFAULT_CELL_ID =
'DefaultCellId'

Instance Method Summary collapse

Methods included from SimpleView::Layout

#add_view, #create_view, included, #setup, #view_stack

Instance Method Details

#numberOfSectionsInTableView(tableView) ⇒ Object

UITableView dataSource and delegate



25
26
27
# File 'app/simple_view_controller.rb', line 25

def numberOfSectionsInTableView tableView
  1
end

#tableView(tableView, didSelectRowAtIndexPath: indexPath) ⇒ Object



29
30
31
# File 'app/simple_view_controller.rb', line 29

def tableView tableView, numberOfRowsInSection: section
  @demos.size
end

#viewDidLoadObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/simple_view_controller.rb', line 6

def viewDidLoad
  super

  self.title = 'Demo'

  @demos = [
    {caption: 'View Anchoring', controller: ViewAnchoringController},
    {caption: 'User Info', controller: UserInfoController}
  ]

  setup view do
    table_view delegate: self, dataSource: self, width: 100.percent, height: 100.percent do |table|
      table.registerClass UITableViewCell, forCellReuseIdentifier: DEFAULT_CELL_ID
    end
  end
end