Skip to content
Browse files

Some simplification

  • Loading branch information...
1 parent c584f04 commit 29a02e8c4add651e26e6e26a30b17a01d26abd8d Jonathan Penn committed
View
32 app/view_controllers/countdown_collection_table_view_controller.rb
@@ -21,7 +21,7 @@ def openCountdownAtIndex index
#
def viewDidLoad
- setupController
+ self.title = "Countdowns"
setupNavButtons
setupTableView
@@ -47,6 +47,19 @@ def shouldAutorotateToInterfaceOrientation orientation
# Table View Callbacks
#
+ def tableView tableView, numberOfRowsInSection: section
+ collection.length
+ end
+
+ def tableView tableView, cellForRowAtIndexPath: path
+ countdown = collection[path.row]
+
+ cell = CountdownCollectionTableViewCell.cell
+ cell.countdown = countdown
+
+ cell
+ end
+
def tableView tableView, didSelectRowAtIndexPath: path
countdown = collection[path.row]
if tableView.isEditing
@@ -63,10 +76,6 @@ def tableView tableView, didSelectRowAtIndexPath: path
tableView.deselectRowAtIndexPath(path, animated: true)
end
- def tableView tableView, numberOfRowsInSection: section
- collection.length
- end
-
def tableView tableView, commitEditingStyle: style, forRowAtIndexPath: path
if style == UITableViewCellEditingStyleDelete
collection.deleteAt(path.row)
@@ -76,15 +85,6 @@ def tableView tableView, commitEditingStyle: style, forRowAtIndexPath: path
end
end
- def tableView tableView, cellForRowAtIndexPath: path
- countdown = collection[path.row]
-
- cell = CountdownCollectionTableViewCell.cell
- cell.countdown = countdown
-
- cell
- end
-
private
@@ -92,10 +92,6 @@ def tableView tableView, cellForRowAtIndexPath: path
# Setup
#
- def setupController
- self.title = "Countdowns"
- end
-
def setupNavButtons
navigationItem.leftBarButtonItem = editButtonItem
addButtonItem = UIBarButtonItem.alloc.initWithBarButtonSystemItem(
View
3 app/view_controllers/countdown_view_controller.rb
@@ -6,7 +6,7 @@ class CountdownViewController < UITableViewController
attr_reader :instructionsView
def self.controller
- self.alloc.init
+ alloc.init
end
def update
@@ -46,7 +46,6 @@ def countdownCalculator
def viewDidLoad
super
-
setupTableView
end

0 comments on commit 29a02e8

Please sign in to comment.
Something went wrong with that request. Please try again.