Decrement the static row count instead of using hard-coded values

This commit is contained in:
Phil Viso 2019-05-19 19:20:35 -05:00
parent 1271fc9081
commit 633e291c2e
2 changed files with 7 additions and 5 deletions

View File

@ -126,11 +126,12 @@ class AddFeedViewController: UITableViewController, AddContainerViewControllerCh
} }
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 1 { let defaultNumberOfRows = super.tableView(tableView, numberOfRowsInSection: section)
return shouldDisplayPicker ? 2 : 1 if section == 1 && !shouldDisplayPicker {
return defaultNumberOfRows - 1
} }
return super.tableView(tableView, numberOfRowsInSection: section) return defaultNumberOfRows
} }

View File

@ -64,11 +64,12 @@ class AddFolderViewController: UITableViewController, AddContainerViewController
} }
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let defaultNumberOfRows = super.tableView(tableView, numberOfRowsInSection: section)
if section == 1 && !shouldDisplayPicker { if section == 1 && !shouldDisplayPicker {
return 1 return defaultNumberOfRows - 1
} }
return super.tableView(tableView, numberOfRowsInSection: section) return defaultNumberOfRows
} }
} }