Created
February 1, 2015 23:12
-
-
Save roothybrid7/7232fadcc48e481246f0 to your computer and use it in GitHub Desktop.
SDWebImageのダウンロード処理を、ネットワークのステータスに応じて制御する ref: http://qiita.com/roothybrid7/items/da1b78a63662e389624d
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
@implementation APIManager | |
/*! | |
@note ネットワーク状況によって、画像ダウンロード処理の停止・再開を行う | |
*/ | |
+ (void)initialize { | |
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { | |
switch (status) { | |
case AFNetworkReachabilityStatusReachableViaWWAN: | |
case AFNetworkReachabilityStatusReachableViaWiFi: | |
{ | |
[[SDWebImageDownloader sharedDownloader] setSuspended:NO]; | |
break; | |
} | |
case AFNetworkReachabilityStatusUnknown: | |
case AFNetworkReachabilityStatusNotReachable: | |
default: | |
{ | |
[[SDWebImageDownloader sharedDownloader] setSuspended:YES]; | |
break; | |
} | |
} | |
}]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment