Skip to content

Commit

Permalink
Fixed #133 - apply meal coloration to nearby
Browse files Browse the repository at this point in the history
Applied the same meal coloration that I was using in Menu to Nearby's
menu.
  • Loading branch information
audreyseo committed Feb 3, 2017
1 parent 12333ed commit cf22644
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions WellesleyFresh/MenuViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class MenuViewController: UITableViewController, UIPickerViewDataSource, UIPicke
let ind = diningHallFull.index(of: defaultDiningHall)
diningHall = diningHalls[ind!]
diningHallName = diningHallFull[ind!]
self.navigationItem.title = "Menu - \(diningHallName)"
tableView.reloadData()
}
}
Expand Down
19 changes: 18 additions & 1 deletion WellesleyFresh/NearbyViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,24 @@ class NearbyViewController: UIViewController, CLLocationManagerDelegate, UIPicke
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let myCell = tableView.dequeueReusableCell(withIdentifier: "cellId", for: indexPath) as! MyCell
if (self.items.count > 0) {
myCell.nameLabel.text = items[indexPath.row]
myCell.nameLabel.text = self.items[indexPath.row]
let meals = ["Breakfast", "Lunch", "Dinner"]
// print(myCell.nameLabel.text)
if meals.contains(items[indexPath.row]) {
myCell.backgroundView?.backgroundColor = UIColor.groupTableViewBackground
myCell.backgroundColor = UIColor.groupTableViewBackground
myCell.separatorInset = myCell.regularSepInsets
myCell.nameLabel.font = myCell.boldFont
} else {
myCell.backgroundColor = UIColor.white
myCell.nameLabel.font = myCell.regularFont
}

if indexPath.row + 1 < items.count {
if meals.contains(items[indexPath.row + 1]) {
myCell.separatorInset = myCell.regularSepInsets
}
}
} else {
myCell.nameLabel.text = ""
}
Expand Down

0 comments on commit cf22644

Please sign in to comment.