Sha256: 7036cab2c43ecdf2aab9f697d366eae4d0532a317b390dead41d6dc35c7de547

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

waxClass{"CapitalsTable", UITableViewController, protocols = {"UITableViewDataSource"}}

function init(self, state)
  self.super:initWithStyle(UITableViewStyleGrouped)
  self.state = state
  self:setTitle(state.name)
  return self
end


function viewDidLoad(self)
  self:tableView():setDataSource(self)
end

-- DataSource
-------------
function numberOfSectionsInTableView(self, tableView)
  return 1
end

function tableView_numberOfRowsInSection(self, tableView, section)
  return #table.keys(self.state)
end

function tableView_cellForRowAtIndexPath(self, tableView, indexPath)  
  local identifier = "CapitalsTableCell"
  local cell = tableView:dequeueReusableCellWithIdentifier(identifier) or
               UITableViewCell:initWithStyle_reuseIdentifier(UITableViewCellStyleValue1, identifier)  

  local key = table.keys(self.state)[indexPath:row() + 1]
  cell:detailTextLabel():setText(tostring(self.state[key]))
  cell:textLabel():setText(key)
  cell:setSelectionStyle(UITableViewCellSelectionStyleNone)

  return cell
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
candle-0.0.7 lib/candle/generators/templates/table/scripts/CapitalsTable.lua
candle-0.0.6 lib/candle/generators/templates/table/scripts/CapitalsTable.lua