Sha256: 7153b0957e7aa8bdb417c3089f169e588f3d956081c3c4acefef0122c96b4c86
Contents?: true
Size: 1.85 KB
Versions: 14
Compression:
Stored size: 1.85 KB
Contents
class WordsViewController < UITableViewController WORDS = [ [ "Single words", %w{ alias axis buffalo bus cat child cow crisis dog house man matrix mouse move octopus ox parenthesis person quiz series sex vertex zombie } ], [ "Uncountable words", %w{ equipment fish information jeans money police rice series sheep species } ], [ "Programming", %w{ app_delegate motion_support motion_support/inflector ruby_motion } ], [ "Acronyms", %w{ free_bsd html_api html_tidy ui_image ui_table_view_controller xml_http_request } ] ] def initWithParent(parent) @parent = parent self.title = "Select word" self end def numberOfSectionsInTableView(tableView) WORDS.size end def tableView(tableView, titleForHeaderInSection:section) WORDS[section].first end def tableView(tableView, numberOfRowsInSection:section) WORDS[section].last.size end def tableView(tableView, cellForRowAtIndexPath:indexPath) fresh_cell.tap do |cell| cell.textLabel.text = WORDS[indexPath.section].last[indexPath.row] end end def tableView(tableView, didSelectRowAtIndexPath:indexPath) @parent.set_word(WORDS[indexPath.section].last[indexPath.row]) navigationController.popViewControllerAnimated(true) end private def fresh_cell tableView.dequeueReusableCellWithIdentifier('Cell') || UITableViewCell.alloc.initWithStyle(UITableViewCellStyleSubtitle, reuseIdentifier:'Cell') end end
Version data entries
14 entries across 14 versions & 2 rubygems