-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
94 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import UIKit | ||
|
||
class AllListsViewController: UITableViewController { | ||
|
||
var lists = [ | ||
Checklist(name: "Birthdays"), | ||
Checklist(name: "Groceries"), | ||
Checklist(name: "Cool Apps"), | ||
Checklist(name: "To Do") | ||
] | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
} | ||
|
||
override func didReceiveMemoryWarning() { | ||
super.didReceiveMemoryWarning() | ||
} | ||
|
||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
return lists.count | ||
} | ||
|
||
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | ||
let cell = cellForTableView(tableView) | ||
|
||
let checklist = lists[indexPath.row] | ||
cell.textLabel!.text = checklist.name | ||
cell.accessoryType = .DetailDisclosureButton | ||
|
||
return cell | ||
} | ||
|
||
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { | ||
let checklist = lists[indexPath.row] | ||
performSegueWithIdentifier("ShowChecklist", sender: checklist) | ||
} | ||
|
||
func cellForTableView(tableView: UITableView) -> UITableViewCell { | ||
let cellIdentifier = "Cell" | ||
if let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier) { | ||
return cell | ||
} else { | ||
return UITableViewCell(style: .Default, reuseIdentifier: cellIdentifier) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import UIKit | ||
|
||
class Checklist: NSObject { | ||
var name: String | ||
|
||
init(name: String) { | ||
self.name = name | ||
super.init() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters