Created
August 22, 2010 02:21
-
-
Save encryptio/543182 to your computer and use it in GitHub Desktop.
This file contains 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
- (void)loadImage { | |
NSURL *url = [db getImageURL:mnam node:nodeidx]; | |
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; | |
[[URLHandler mainHandler] dataForURL:url sentTo:^(BOOL worked, NSData *data){ | |
if ( !worked ) { | |
UIAlertView *alert = [[UIAlertView alloc] | |
initWithTitle:@"Network Failure" | |
message:@"Couldn't download the comic. Make sure you're connected to a network." | |
delegate:self | |
cancelButtonTitle:nil | |
otherButtonTitles:@"OK", nil]; | |
[alert show]; | |
[alert autorelease]; | |
} else { | |
iv = [[UIImageView alloc] initWithImage:[UIImage imageWithData:data]]; | |
sv.contentSize = CGSizeMake(iv.bounds.size.width, iv.bounds.size.height); | |
sv.scrollEnabled = YES; | |
sv.delegate = self; | |
[sv addSubview:iv]; | |
[self doSizeCheck]; | |
[self checkMarkCurrent]; | |
} | |
[MBProgressHUD hideHUDForView:self.view animated:NO]; | |
} withProgress:^(int current, int total){ | |
if ( total != 0 ) { | |
hud.mode = MBProgressHUDModeDeterminate; | |
hud.progress = (float)current/total; | |
} | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment