2011-07-05 11 views

答えて

2

はNSDictionaryの内側に含まれているかどうか確認する必要があり、ここで、私がメインNSDictionaryの内部値としてそこにNSStringのことになると仮定し、ここでその

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tV{ 
return 1; 
} 
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section{ 
return [dictMain count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tV cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
static NSString *reuseIdentifier = @"Cell"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier]; 
if (cell==nil) { 
    cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier] autorelease]; 
} 
NSString *value = [dicMain objectForKey:[[dicMain allKeys] objectAtIndex:indexPath.row]]; 
cell.textLabel.text = value; 
return cell; 
} 
+0

'allKeys'は、予測可能な順序の配列を与えません。だから、 'allKeys'が呼び出されるたびに同じものに頼るべきではありません。 –

+1

はい、しかし、開発者は別の配列でallKeysを取って、自分の要件に従ってソートしてから、その配列を使うことができます。 – iMOBDEV

+0

それは行く方法です。 –

関連する問題