对该字典进行排序的代码是什么:
{
"a) Saudi Arabia" = (
"2012/06/04 Huge Sandstorm",
"2011/03/30 Huge Sandstorm"
);
"b) Niger" = (
"2012/05/27 Huge Sandstorm"
);
"c) ****** QUATRE" = (
"2011/03/30 7Huge Sandstorm over niger",
"2011/03/30 8Huge Sandstorm over niger",
);
}
对于我的 UItableView ?
使用此代码,我的标题标题部分是有序的,但不是内容:
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
NSArray *allKeys = [[states allKeys] sortedArrayUsingSelector:@selector(compare:)];
return [allKeys objectAtIndex:section];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
NSArray *allKeys = [states allKeys] ;
NSString *curKey = [allKeys objectAtIndex:indexPath.section];
NSArray *curArray = [states objectForKey:curKey];
curValue = [curArray objectAtIndex:indexPath.row];
cell.textLabel.text = curValue;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
[[cell textLabel] setFont:[UIFont systemFontOfSize:12.0]];
return cell;
}
有人可以帮我吗?