[Code Note] iOS-SDWebImage usage, note ios-sdwebimage
1. Engineering Drawing.
Ii. Code.
RootViewController. m
# Import "RootViewController. h "// Add the header file # import" UIImageView + WebCache. h "@ interface RootViewController () @ end @ implementation RootViewController-(id) initWithNibName :( NSString *) bundle :( NSBundle *) handle {self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (self) {// Custom initialization} return self;}-(void) viewDidLoad {[super viewDidLoad]; // Do any additiona L setup after loading the view. self. title = @ "SDWebImage used"; // view UIImageView * imageView = [[UIImageView alloc] initWithFrame: CGRectMake (50,100,200,200)]; imageView. backgroundColor = [UIColor redColor]; [self. view addSubview: imageView]; // url is the online image address NSString * url = @ "http://f.dalang.gov.cn/uppic/2011-7-16/2011071610283352633.jpg"; // when the urldoes not exist, use the original image 1.jpg for loading. [ImageView setImageWithURL: [NSURL URLWithString: url] placeholderImage: [UIImage imageNamed: @ "1.jpg"];}