【发布时间】:2017-02-17 05:36:27
【问题描述】:
【问题讨论】:
-
在提问之前做一些基础研究。有很多基于这个主题的教程和其他线程。签出此stackoverflow.com/a/35009150/3578310
标签: ios swift3 tableview viewcontroller
【问题讨论】:
标签: ios swift3 tableview viewcontroller
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let header = UIView(frame: CGRect(0,0,view.frame.width,30))
return header
}
创建一个视图,其中包含两个按钮排序和过滤并在上面的函数中返回,也不要忘记在下面的函数中返回高度
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat
这会给你像 Myntra 应用程序这样的粘性标题
或在tableView.tableHeaderView = yourview 中返回视图,但这不会粘住并沿滚动条滚动
【讨论】: