- [download cancel] 相当于给 download 给它一个标记 但是不会马上给他去掉, 需要在 main 方法中进行判断 if(self.isCancelled) return
- 分类中不能有属性 要重写他的 getter 方法 setter 方法
- 要是必须有属性 用到运行时的关联对象 整个OC,Swift 底层都是运行时 能获取类的所有属性
需要用到关联对象,将新传入的 currentURLString 保存起来
导入 c 库 #import<objc/runtime>
#define CZAssociatedObject "AZAssociatedObject"
- (void)setCurrentURLString:(NSString *)currentURLString{
objc_setAssociatedObject(self, CZAssociatedObject, currentURLString, OBJC_ASSOCIATION_COPY_NONATOMIC);
}
- (NSString *)currentURLString{
return objc_getAssociatedObject(self, CZAssociatedObject);
}
1要把新值绑定到那个对象身上 self
2键名
3你要保存的新枝 传入的值
4属性策略 字符串的话用 copy 枚举
- nsurl *url = [[nsbundle mainbundle] urlforresource
- sdwebImage 如果想要监听进度 必须使用 sdWebImageProgressiveDownload 这个枚举
- 只下载 用 SDWebImageDownloader *download = [SDWebImageDownload share--];
[download downloadImageWithURL---];
- NSCache 和 dictionary 极其相似
totalCostlimit 以 M 来算的 countLimit 几条 多了这两个属性
- nscache 的代理方法
cache willEvictObject:--