I'm building an iOS app for a class, and I'm following along some instructions. The Edit button is connected to toggleEditingMode, but when I change the text, for some reason the font size is reset to 17, even though it's 30 in the storyboard editor.
I've tried changing the font size, if I print the current font size after executing setTitle it still says 30, so it seems like it must be happening outside of setTitle, but it only triggers if I use setTitle. Help!
class ItemsViewController: UITableViewController {
var choreStore: ChoreStore!
var roommateStore: RoommateStore!
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return choreStore.allChores.count
}
override func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Create an instance of UITableViewCell with default appearance
let cell = tableView.dequeueReusableCell(withIdentifier: "chore", for: indexPath) as! ChoreCell
// Set the text on the cell with the description of the item
// that is at the nth index of items, where n = row this cell
// will appear in on the table view
let chore = choreStore.allChores[indexPath.row]
cell.title?.text = chore.title
cell.turn?.text = "\(chore.whoseTurn())'s Turn"
cell.completed?.text = chore.completedString()
cell.completed?.textColor = chore.isOverdue ? .red : .black
return cell
}
@IBAction func addNewItem(_ sender: UIButton) {
}
@IBAction func toggleEditingMode(_ sender: UIButton) {
setEditing(!isEditing, animated: true)
sender.setTitle(isEditing ? "Done" : "Edit", for: .normal)
}
}