Reputation: 787
Please consider this code:
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];
// I have got this data is in console NOW I WANT TO PRINT IT UITextView but HOW I can do it
faqdetails = (
{
faqAns = "Yes, Jack Kalis is the best crickter";
faqQues = "who is the best cricketer in present year?";
}
);
}
Upvotes: 0
Views: 852
Reputation: 16317
Assuming you have a UITextView instance called myTextView
, made either programatically or through IB, try this:
[myTextView setText:faqdetails];
Upvotes: 0
Reputation: 22633
Your question isn't particularly clear regarding what you want to show where, but dropped text into a UITextView couldn't be easier.
[yourTextView setText: [[rowsForQuestion objectAtIndex: 0] objectForKey: @"faqQues"]];
The above code grabs the first dict from rowsForQuestion
, and puts its value for @"faqQues"
into a UITextView.
Upvotes: 1