ios 关于UITableView UITableViewCellAccessoryCheckmark 混乱的(3)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-01 14:19 点击:次
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellStr= @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellStr];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellStr];
}
NSArray *keys=[tempResult allKeys];
NSArray *dicts= [tempResult valueForKey:[keys objectAtIndex:indexPath.section]];
NSDictionary *temp=[dicts objectAtIndex:indexPath.row];
cell.textLabel.text=[temp valueForKey:@"name"];
if([selectedData containsObject:temp]){
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}else{
cell.accessoryType=UITableViewCellAccessoryNone;
}
return cell;
}
static NSString *cellStr= @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellStr];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellStr];
}
NSArray *keys=[tempResult allKeys];
NSArray *dicts= [tempResult valueForKey:[keys objectAtIndex:indexPath.section]];
NSDictionary *temp=[dicts objectAtIndex:indexPath.row];
cell.textLabel.text=[temp valueForKey:@"name"];
if([selectedData containsObject:temp]){
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}else{
cell.accessoryType=UITableViewCellAccessoryNone;
}
return cell;
}
上面的if else 要完整。
其实思想就是MVC,视图只是用来展示,到底展示什么取决于model;
相关新闻>>
- 发表评论
-
- 最新评论 进入详细评论页>>
今日头条
更多>>您可能感兴趣的文章
- iPhone开发 调用阿asp.net程序的webservice
- (iOS-iap防护)验证用户付费收据,拒绝iap
- iPhone开发 文件的增加删除查询
- ios 时间定时器 NSTimer应用demo
- Cocoa Core Competencies 的Object creation 和IOS面试题示例
- iphone-使用TextField及关闭键盘(useing TextField for in
- 深入理解iPhone静态库(手把手教你iphone开发
- iphone开发基础三和c语言混编
- iOS文件存磁盘的设想
- ios 关于UITableView UITableViewCellAccessoryCheckmark 混乱的
新闻点评
新闻关注排行榜
热门推荐
最新推荐