ios - UIImageView+AFNetworking maxConcurrentOperationCount -
this awesome uiimageview
extension has af_sharedimagerequestoperationqueue
, max concurrent number set
_af_sharedimagerequestoperationqueue.maxconcurrentoperationcount = nsoperationqueuedefaultmaxconcurrentoperationcount;
how access private field , set custom value maxconcurrentoperationcount
? (i don't want edit files under cocoapods directly)
upd: generatorofone, looks best solution me. however, decided use sdwebimage, because provides cache out of box , allows set maxconcurrentoperationcount
in line of code.
this private method has static nsoperationqueue. either go , poke code directly not change existing code librarues. suggest create new uiimageview category, expose method , set maxconcurrentoperationcount on it.
like,
@interface uiimageview(myextension) + (nsoperationqueue *)af_sharedimagerequestoperationqueue; @end @implementation uiimageview(myextension) + (void)load { nsoperationqueue *queue = [self af_sharedimagerequestoperationqueue]; queue.maxconcurrentoperationcount = 5; } @end
then, include extension in class , set maxconcurrentoperationcount.
Comments
Post a Comment