Created
October 21, 2011 07:36
-
-
Save aaronpearce/1303303 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sets to allow into the block | |
__block APAppDelegate *appDele = (APAppDelegate *)[[UIApplication sharedApplication] delegate]; | |
__block APMasterViewController *amvc = [appDele.navigationController topViewController]; | |
id result = [appDele DiFiRequestWithURL:url]; | |
// Runs a loop on the result looping through the responses | |
[[result valueForKey:@"response"] enumerateObjectsUsingBlock:^(id response, NSUInteger idx, BOOL *stop) { | |
// Checks if count is not 0? | |
if([[response valueForKeyPath:@"content.result.count"] objectAtIndex:0] != 0) { | |
// Loops through the hits from the query | |
[[[response valueForKeyPath:@"content.result.hits"] objectAtIndex:0] enumerateObjectsUsingBlock:^(id hit, NSUInteger idx, BOOL *stop) { | |
// Checks if there are hits | |
if([hit count] != 0) { | |
// add to the dataSet to be shown | |
[amvc.dataSet addObject:hit]; | |
} | |
}]; | |
} | |
// if stop is true, reload the table | |
if(stop) | |
[amvc.tableView reloadData]; | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment