在我的应用程序中,iam通过JSON Webservices绑定数据,iam在Tableview中加载数据。基于Table视图中的选定值,我必须将数据绑定到来自以下Webservices的另一个表视图中。
http://hrmsiphone.atrity.info:7006/HRMSService.svc/DisplayEmpSalaryDetails/
Unit=A-upper,Category=Staff.
继承Tableview Coding,
Unit = [NSString stringWithFormat:@"%@",[self.Details1
objectAtIndex:indexPath.row]];
NSLog (@"THE SELECTED UNIT IS: %@", Unit);
但是当我从Tableview中选择Value时,它会将值传递为{\ n UNIT =“A-Upper”; / n},但我只需要获得“A-Upper”。我尝试了很多方法,但我没有得到正确的价值。任何关于此的想法都可能有所帮助。
答案 0 :(得分:2)
self.Details1
是一系列词典。首先,您已从字典中获取值,如下所示。
NSString *val = [[self.Details1 objectAtIndex:indexPath.row] valueForKey:@"Unit"];
答案 1 :(得分:0)
你的数组是一组dictonary所以首先你必须像这样解析它
NSDictionary *tempDictionary = [self.Details1 objectAtIndex:indexPath.row];
Unit = [tempDictionary objectForKey:@"UNIT"];