UITableView 头标题和尾标题设置

2016-06-15  本文已影响180人  Laughingg

其他代理方法的使用

1、组标题设置

// 组头标题
optional public func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? // fixed font style. use custom view (UILabel) if you want something different // 固定的字体样式,想要做一些不同的就使用自定义视图

// 组尾标题
optional public func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String?

代码体现

/* 使用这种方式设置的组头和组尾标题的字体样式都是统一的,不能进行自定义 */
// 设置组头标题
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return "\(section)组组头"
}
    
// 设置组尾标题
func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? {
        return "\(section)组组尾"
}

效果图

Snip20160602_28.png
上一篇 下一篇

猜你喜欢

热点阅读