Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何将nssarray对象保存为字符串_Iphone_Objective C_Cocoa Touch - Fatal编程技术网

Iphone 如何将nssarray对象保存为字符串

Iphone 如何将nssarray对象保存为字符串,iphone,objective-c,cocoa-touch,Iphone,Objective C,Cocoa Touch,我想将nssarray对象保存到字符串中。代码是 for (NSMutableDictionary *dictionary in blogEntries) { NSArray *titlearray = [dictionary objectForKey:@"title"]; // know i want to store the object in titlearray into string how shoud i nsstring *STemp=? how sho

我想将nssarray对象保存到字符串中。代码是

for (NSMutableDictionary *dictionary in blogEntries)
{ 
    NSArray *titlearray = [dictionary objectForKey:@"title"];

    // know i want to store the object in titlearray into string how shoud i
    nsstring *STemp=? how should i write
    NSRange titleResultsRange=[sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch];

    if(titleResultsRange.length>0)
    {
        NSDictionary *titlearrayDic=[NSDictionary  dictionaryWithObject:titlearray forKey:@"title"];
        [storeAll addEntriesFromDictionary:titlearrayDic];
        [listOfItems addObject:[storeAll copy]];
    }
}

提前谢谢

我不确定是否正确理解了这个问题,但原则上应该正确理解 可以这样做:

NSMutableString sb = [[NSMutableString alloc] init];
for (NSString* word in titlearray)
  [sb appendWithFormat:word];

你有没有考虑过将你的问题格式化,使它们实际上是可读的?这里有一个“编辑”按钮……如果你在面试时给了我这样的代码格式,我就不会雇用你——当然,这样的代码格式会让阅读和调试成为一场噩梦吗?@Eiko和Dean你给了我-1票,这不公平。我不熟悉c语言,其次我的英语不好是因为我来自巴基斯坦,我的语言是乌尔都语而不是英语。这伤害了我,我知道我很难过……我没有投反对票。但我真的建议从一开始就写一本关于编程的好书,即Hillegass的书。对基础课和基础课有很好的理解是必要的,否则你会遇到很多问题,很快就会沮丧。好的,谢谢。我将学习这本书的承诺…