Class: UserInfoController

Inherits:
UIViewController
  • Object
show all
Includes:
SimpleView::Layout
Defined in:
app/user_info_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



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

def numberOfSectionsInTableView tableView
  @data.size
end

#tableView(tableView, didSelectRowAtIndexPath: indexPath) ⇒ Object



33
34
35
# File 'app/user_info_controller.rb', line 33

def tableView tableView, numberOfRowsInSection: section
  @data[section].size
end

#viewDidLoadObject



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

def viewDidLoad
  super

  self.title = 'User Info'

  @data = [
    [{title: 'mobile', text: '123456789'}],
    [{title: 'email', text: '[email protected]'}],
    [{title: 'Facebook', text: 'Nyan Cat'}]
  ]

  setup view do
    table_view style: UITableViewStyleGrouped,
      delegate: self, dataSource: self,
      width: 100.percent, height: 100.percent do |table|

      table.tableHeaderView = UserInfoHeader.alloc.initWithFrame [[0, 0], [view.width, 80]]
    end
  end
end