- (void) viewdidload {[Super viewdidload]; Self.navigationItem.rightBarButtonItem= [[Uibarbuttonitem alloc] Initwithtitle:@"Clear Cache"Style:uibarbuttonitemstyleplain target:self Action: @selector (ClearCache)]; //gets the amount of disk capacity (in bytes) that the Sdwebimage picture occupiesNsuinteger bytesize =[Sdimagecache sharedimagecache].getsize; Doublesize = bytesize/1000.0/1000.0;//mac and iOS systems before byte and KB are turned on each other;Self.navigationItem.title= [NSString stringWithFormat:@"Cache%.1FM", size];}//Clear Cache- (void) ClearCache {//Create a small chrysanthemumUiactivityindicatorview *indicator =[[Uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; Self.navigationItem.rightBarButtonItem=[[Uibarbuttonitem alloc] initwithcustomview:indicator]; [Indicator startanimating]; //empty sdwebimage cache picture[[Sdimagecache Sharedimagecache] cleardisk]; Self.navigationItem.rightBarButtonItem= [[Uibarbuttonitem alloc] Initwithtitle:@"Clear Cache"Style:uibarbuttonitemstyleplain target:self Action: @selector (ClearCache)]; Self.navigationItem.title=@"Cache 0M";}
Final effect:
Sina Weibo Client (61)-Clear picture cache