【发布时间】:2020-04-16 02:03:46
【问题描述】:
我正在开发一个送餐应用程序,在该应用程序中,我在一家商店有多个菜单类别。我在单个表视图中有项目。所以当我到达每个部分的标题(例如早餐然后早餐标签应该是活动的)时,如何相应地更改标签?enter image description here
【问题讨论】:
标签: ios tabs tableview uisegmentedcontrol swift5
我正在开发一个送餐应用程序,在该应用程序中,我在一家商店有多个菜单类别。我在单个表视图中有项目。所以当我到达每个部分的标题(例如早餐然后早餐标签应该是活动的)时,如何相应地更改标签?enter image description here
【问题讨论】:
标签: ios tabs tableview uisegmentedcontrol swift5
使用这两种方法将标题放在节中..
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return "Section \(section)"
}
override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let vw = UIView()
vw.backgroundColor = UIColor.red
return vw
}
【讨论】: