【问题标题】:Sync tabs with tableview scroll in IOS在 IOS 中使用 tableview 滚动同步选项卡
【发布时间】:2020-04-16 02:03:46
【问题描述】:

我正在开发一个送餐应用程序,在该应用程序中,我在一家商店有多个菜单类别。我在单个表视图中有项目。所以当我到达每个部分的标题(例如早餐然后早餐标签应该是活动的)时,如何相应地更改标签?enter image description here

【问题讨论】:

    标签: ios tabs tableview uisegmentedcontrol swift5


    【解决方案1】:

    使用这两种方法将标题放在节中..

    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
    }
    

    【讨论】:

      猜你喜欢
      • 2020-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多