Mac OS开发MAC 开发

MAC 开发 - 使用SDWebImage

2017-08-16  本文已影响18人  _哼哼_

MAC 开发 - 使用SDWebImage

最新版SDWebImage 已经支持 MAC ,但是需要把 UIImage , UIImageView 转换成 NSImage, NSImageView.

#import <TargetConditionals.h>
#if !TARGET_OS_IPHONE
#import <AppKit/AppKit.h>
#ifndef UIImage
#define UIImage NSImage
#endif
#ifndef UIImageView
#define UIImageView NSImageView
#endif
#else
#import <UIKit/UIKit.h>
#endif

其实原理就是 把 sdk中定义的 UIImage UIImageView 定义成 一个宏了,所以在 使用之前 先把上边的宏定义好.

上一篇 下一篇

猜你喜欢

热点阅读