Three20 titleForHeaderInSection
这是我添加的内容。它只是列出每个字母字符下的所有objectsForCharacters。
- (void)tableViewDidLoadModel:(UITableView*)tableView {
items = [[NSMutableArray alloc] init];
arrayOfCharacters = [[NSMutableArray alloc]init];
objectsForCharacters = [[NSMutableDictionary alloc]init];
NSMutableArray *arrayOfNames = [[NSMutableArray alloc]init];
for (Kid_CareAppDelegate_City* post in _searchFeedModel.posts) {
[arrayOfNames addObject:post.city];
[items addObject:[TTTableTextItem itemWithText:post.city
URL:[NSString stringWithFormat:@"tt://city?to=%@",[post.city stringByReplacingOccurrencesOfString:@" " withString:@"+"]]]];
}
for(char c='A';c<='Z';c++){
[arrayOfCharacters addObject:[NSString stringWithFormat:@"%c",c]];
[objectsForCharacters setObject:arrayOfNames forKey:[NSString stringWithFormat:@"%c",c]];
}
NSLog(@"Array %@",arrayOfCharacters);
NSLog(@"Dict %@",objectsForCharacters);
TT_RELEASE_SAFELY(arrayOfNames);
self.items = items;
TT_RELEASE_SAFELY(items);
}
Here is what I added. It just lists all the objectsForCharacters under each one of the alphabet characters.
- (void)tableViewDidLoadModel:(UITableView*)tableView {
items = [[NSMutableArray alloc] init];
arrayOfCharacters = [[NSMutableArray alloc]init];
objectsForCharacters = [[NSMutableDictionary alloc]init];
NSMutableArray *arrayOfNames = [[NSMutableArray alloc]init];
for (Kid_CareAppDelegate_City* post in _searchFeedModel.posts) {
[arrayOfNames addObject:post.city];
[items addObject:[TTTableTextItem itemWithText:post.city
URL:[NSString stringWithFormat:@"tt://city?to=%@",[post.city stringByReplacingOccurrencesOfString:@" " withString:@"+"]]]];
}
for(char c='A';c<='Z';c++){
[arrayOfCharacters addObject:[NSString stringWithFormat:@"%c",c]];
[objectsForCharacters setObject:arrayOfNames forKey:[NSString stringWithFormat:@"%c",c]];
}
NSLog(@"Array %@",arrayOfCharacters);
NSLog(@"Dict %@",objectsForCharacters);
TT_RELEASE_SAFELY(arrayOfNames);
self.items = items;
TT_RELEASE_SAFELY(items);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以查看该链接。http://blog.webscale.co.in/?p= 240
you can check out the link.http://blog.webscale.co.in/?p=240