UITableView 索引

索引的相关属性设置:

tableView.sectionIndexColor = [UIColor blueColor];//设置默认时索引值颜色

tableView.sectionIndexTrackingBackgroundColor = [UIColor grayColor];//设置选中时,索引背景颜色

tableView.sectionIndexBackgroundColor = [UIColor clearColor];//索引背景颜色

实现tableView索引相关的代理


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section


-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section


-(NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView

//响应点击索引时的委托方法

-(NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index;

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 一、简介 <<UITableView(或简单地说,表视图)的一个实例是用于显示和编辑分层列出的信息的一种手段 <<...
    无邪8阅读 13,677评论 3 3
  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 13,880评论 1 32
  • 1.ios高性能编程 (1).内层 最小的内层平均值和峰值(2).耗电量 高效的算法和数据结构(3).初始化时...
    欧辰_OSR阅读 29,972评论 8 265
  • UITableView可以说是iOS开发中最常用的组件,今天来谈谈UITableView如何实现索引和cell添加...
    smalldu阅读 5,708评论 4 30
  • 1、通过CocoaPods安装项目名称项目信息 AFNetworking网络请求组件 FMDB本地数据库组件 SD...
    阳明AI阅读 16,054评论 3 119

友情链接更多精彩内容