美文网首页
UITableView 头标题和尾标题设置

UITableView 头标题和尾标题设置

作者: Laughingg | 来源:发表于2016-06-15 14:18 被阅读180次

    其他代理方法的使用

    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

    相关文章

      网友评论

          本文标题:UITableView 头标题和尾标题设置

          本文链接:https://www.haomeiwen.com/subject/luqpdttx.html