Created
June 4, 2012 13:13
-
-
Save anthonycvella/2868288 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
- (IBAction)JSONLoader:(id)sender | |
{ | |
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; | |
[spinner startAnimating]; | |
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:spinner]; | |
[self refreshServers]; | |
self.navigationItem.leftBarButtonItem = sender; | |
} | |
- (void)refreshServers | |
{ | |
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://old.hungercraft.net/serverlist.php"]]; | |
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) { | |
NSArray *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; | |
_dataJSON = [json copy]; | |
[_tableView reloadData]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment