iOS 異步圖片加載:DBImageView
DBImageView 是非常簡單的異步加載圖片的對象。
Installation
The recommended approach for installating DBImageView is via the CocoaPods package manager, as it provides flexible dependency management and dead simple installation.
Podfile
platform :ios, '6.0' pod 'DBImageView', '~> 1.0' Integration
DBImageView has a simple integration:
#import "DBImageView.h" Add DBImageView:
DBImageView *imageView = [[DBImageView alloc] initWithFrame:(CGRect){ 10, 10, 60, 60 }]; Set the remote image path:
[imageView setImageWithPath:@"remote_image_URL"]; Options
You can set a placeholder:
[imageView setPlaceHolder:[UIImage imageNamed:@"Placeholder"]]; If you use a collection or a table, trigger the load action when you want
- (void) scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
[DBImageView triggerImageRequests:NO];
}
- (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
[DBImageView triggerImageRequests:YES];
} 
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!