これは、同様のコースのネストされた要素のための素晴らしい作品:
* 編集 *を
// Get the JSON feed from site
myRawJson = [[NSString alloc] initWithContentsOfURL:[NSURL
URLWithString:@"http://yoursite.com/mobile_list.json"]
encoding:NSUTF8StringEncoding error:nil];
// Make the content something we can use in fast enumeration
SBJsonParser *parser = [[SBJsonParser alloc] init];
NSDictionary * myParsedJson = [parser objectWithString:myRawJson error:NULL];
[myRawJson release];
allLetterContents = [myParsedJson objectForKey:@"nodes"];
// Create arrays just for the title and Nid items
self.contentTitleArray = [[NSMutableArray alloc]init];
for (NSMutableDictionary * key in myArr) {
NSDictionary *node = [key objectForKey:@"node"];
NSMutableString *savedContentTitle = [node objectForKey:@"title"];
// Add each Title and Nid to specific arrays
//[self.contentTitleArray addObject:contentTitle];
//change each item with & to &
[self.contentTitleArray addObject:[[savedContentTitle
stringByReplacingOccurrencesOfString:@"&"
withString:@"&"]
mutableCopy]];
}
以下のコード、上記のユースケースのようには役に立つかもしれません。
[self.contentTitleArray addObject:[[contentTitle
stringByReplacingOccurrencesOfString:@"&"
withString:@"&"]
mutableCopy]];
出典
2011-12-21 03:21:27
Pat
ありがとうございます!素晴らしい仕事をした。 – quantum
素敵!どうもありがとうございました! +1 –