开发者

Tableview - NSMutableDictionary - currow get integer value? iPhone

开发者 https://www.devze.com 2023-03-09 22:59 出处:网络
How do I get the value of the ID into an Integer.See below: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

How do I get the value of the ID into an Integer. See below:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    NSMutableDictionary *curRow = [myData o开发者_Go百科bjectAtIndex:indexPath.row];

    NSLog(@"Cell Click  %@ %@  -  %@",[curRow objectForKey:@"Name"], [curRow objectForKey:@"ID"], [curRow objectForKey:@"DOB"]);

    UserID= [curRow [objectForKey:@"ID" intValue]  ;  <<<< This doesnt work?


In case the ID is in the dictionary a string you could use

UserID = [[curRow objectForKey:@"ID"] intValue];


You have syntax wrong.

UserID= [curRow [objectForKey:@"ID" intValue]  ;  <<<< This doesnt work?

use below

UserID= [[curRow objectForKey:@"ID"] intValue]  ;  <<<< This will work?
0

精彩评论

暂无评论...
验证码 换一张
取 消