所以我从NSArray
请求(NSDictionary格式)返回Core Data
,如下所示:
{
item = "Black Pipe x21' A53";
}
但是当我尝试将其显示在prototype
单元格中的标签上时,它会显示括号和键。我想提取“item”键并在NSString
上将其显示为label
,因此label
只显示为“Black Pipe x21'A53”。
如果“item”键不是NSDictionary
格式,如何提取文本?我使用的谓词强迫我使用Dictionary
格式。它位于NSArray
对象中。
太困惑了。任何帮助,将不胜感激。我是这个Objective-C
的新手。
谢谢!
答案 0 :(得分:2)
试试这个:
NSString *value = _arrayObj[indexPath.row][@"item"];
答案 1 :(得分:0)
由于您是语言新手,请尝试使用简单的构造。
for(NSDictionary *dict in YOUR_ARRAY) {
NSString *title = [dict valueForKey:@"item"];
}
答案 2 :(得分:0)
for (int i=0; i<array.count; i++)
{
NSDictionary *Dic =[[[NSDictionary alloc]init]autorelease];
Dic=[array objectAtIndex:i];
NSString *str=[NSString stringWithFormat:@"%@",[Dic objectForKey:@"item"]];
}
答案 3 :(得分:0)
试试这个:
NSDictionary *dictionaryName=arrayName[0];
NSstring *str=dictionaryName[@"item"];