UIViewController
の中にUITableView
を設定しようとしています。それは私のためにうまく動作します。私がやったすべてのiOSでUITableViewCellをクリックした後の辞書のキーの値を取得する方法は?
まず、:私はこのようなサーバからの応答を得た
1):
[{"email_id":"[email protected]","id":66,"mobile_no":"1236547895","name":"asad","relation":"dsfs"},{"email_id":"[email protected]","id":67,"mobile_no":"5632145412","name":"raj","relation":"xyz"},{"email_id":"[email protected]","id":68,"mobile_no":"8698819943","name":"suraj","relation":"self"}]
2)表示に成功したプロトタイプセル内のすべての辞書では4つの値。
すなわちemail_id
,mobile_no
,name
およびrelation
である。
注:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [menuItems count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"EmergencyContactCell";
EmergencyContactCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
NSDictionary *content = [menuItems objectAtIndex:indexPath.row];
cell.name.text = content[@"name"];
cell.email.text = content[@"email_id"];
cell.mobile.text =content[@"mobile_no"];
cell.relation.text =content[@"relation"];
return cell;
}
、それは私のために完璧に動作:はここで私は応じて5つのパラメータを得るが、私はここだけで4
を表示私はそのために何をしたかです。
今、私は何をしたいですか?
私はいずれかのセルをクリックすると、その辞書にある特定のIDを取得したいと思います。 は、私はここで何をすべき:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"%ld",(long)indexPath.row);
// What should i do here is my question ??
}
誰もが私の問題を解決することができます。助けが相当になるでしょう。