Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Additional demo project fixes.

  • Loading branch information...
commit 47d554fa54e275eba59c7cacdb3bba3704cea42b 1 parent 1fe0c07
Matej Bukovinski authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 Demo/PullDownControllerDemo/MBImageCell.m
10 Demo/PullDownControllerDemo/MBImageCell.m
View
@@ -61,6 +61,7 @@ - (void)prepareForReuse {
[self.imageView.layer removeAnimationForKey:kImageFadeAnimationKey];
self.imageView.image = nil;
_URL = nil;
+ [self.activityIndicator stopAnimating];
}
#pragma mark - Image
@@ -97,8 +98,15 @@ - (void)setImage:(UIImage *)image animated:(BOOL)animated {
#pragma mark - NSURLConnectionDataDelegate
-- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse *)response {
+- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSHTTPURLResponse *)response {
self.responseData = [[NSMutableData alloc]init];
+ int code = [response statusCode];
+ if (code != 200) {
+ [connection cancel];
+ NSDictionary *info = @{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Invalid response code (%d).", code]};
+ NSError *error = [NSError errorWithDomain:@"MBImageCell" code:code userInfo:info];
+ [self connection:connection didFailWithError:error];
+ }
}
- (void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data {
Please sign in to comment.
Something went wrong with that request. Please try again.