请考虑以下代码:
NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:[ NSURL URLWithString:url ]]; // Pulls the URL
NSLog(@"jsonreturn#########=%@",jsonreturn); // Look at the console and you can see what the restults are
NSData *jsonData = [jsonreturn dataUsingEncoding:NSUTF32BigEndianStringEncoding];
CJSONDeserializer *theDeserializer = [CJSONDeserializer deserializer];
theDeserializer.nullObject = NULL;
NSError *error = nil;
NSDictionary *dictt = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];
NSLog(@"###dict=%@", dictt);
if (dictt) {
rowsForQuestion = [[dictt objectForKey:@"faqdetails"] retain];// NSArray rowsForQuestion
}
[jsonreturn release];
//我有这个数据在控制台中我现在想要打印它UITextView但我怎么做呢
faqdetails = (
{
faqAns = "Yes, Jack Kalis is the best crickter";
faqQues = "who is the best cricketer in present year?";
}
);
}
答案 0 :(得分:1)
您的问题并不是特别清楚,您想要在哪里展示,但将文本放入UITextView可能会更容易。
[yourTextView setText: [[rowsForQuestion objectAtIndex: 0] objectForKey: @"faqQues"]];
上面的代码从rowsForQuestion
抓取第一个dict,并将其@"faqQues"
的值放入UITextView。
答案 1 :(得分:0)
假设您有一个名为myTextView
的UITextView实例,无论是以编程方式还是通过IB方式进行,请尝试以下方法:
[myTextView setText:faqdetails];