UITableView 头标题和尾标题设置

其他代理方法的使用

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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,993评论 19 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,593评论 25 708
  • 每个人都有一项独特的能力如同头顶上的那片云自己做起来很容易其他人却花费大量精力效果却不如尽如意此之谓如鼎之镇 时常...
    承谦阅读 261评论 0 1
  • 希望用镜头,记录下不愿被消失的它们!
    小乌龟慢慢爬_阅读 152评论 0 0