tableview 索引条问题
来源:互联网 发布:破解平台软件下载 编辑:程序博客网 时间:2024/06/08 14:24
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
// 有问题的写法
#pragma mark -- 创建 section-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{ return _sectionIndexArray;}- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index{ for (int i = 0; i < _letterPatientsGroupArray.count; i++) { LetterPatients *letterPatients = [_letterPatientsGroupArray objectAtIndex:i]; if ((letterPatients.letterFirst > title) && i > 0) { return i - 1; }// lab.text = [NSString stringWithFormat:@" %@",letterPatients.letterFirst]; } return index;}
// 正确
#pragma mark -- 创建 section-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{ return _sectionIndexArray;}- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index{ //初始化索引 for (int i = 0; i < [_letterPatientsGroupArray count]; i++) { LetterPatients *info = _letterPatientsGroupArray[i]; if ([info.letterFirst isEqualToString:title]) { return i; } } return NSNotFound;;}
0 0
- tableview 索引条问题
- 修改tableview索引条背景颜色变透明或其他颜色的方法
- 修改tableview索引背景
- TableView索引的添加
- 自定义的tableView 索引
- tableview的索引值
- tableview加索引
- iOS tableView索引
- iOS tableView分区+索引
- tableView侧边栏索引
- Tableview添加索引
- TableView表格索引的建立
- tableview的索引颜色设置
- 自定义tableview索引,字母搜索
- ios tableView那些事 (十三) 给 tableview 添加索引
- ios tableView那些事 (十三) 给 tableview 添加索引
- tableView reloadData 出现问题
- tableView一些小问题
- iOS Provisioning Profile(Certificate)与Code Signing详解
- java输出获取英文字母
- 一个应届毕业生的求职回忆录(留给自己)
- NetIQChariot5.4网络带宽测试工具使用的代价!!!
- 1.BUG单
- tableview 索引条问题
- 2015/8/13/客户端服务器数据库综合
- SpringMVC在IE下出现无法启动应用程序的错误!
- CoreImage 中的模糊滤镜
- 最优间隔分类、原始/对偶问题、SVM对偶—斯坦福ML公开课笔记7
- leetcode Minimum&&Max Depth of Binary Tree 求树的最小&&最大深度
- How browsers work
- MySql 定时任务 Event Scheduler
- DetachedCriteria离线查询示例