微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > iOS开发常用的第三方类库

iOS开发常用的第三方类库

时间:10-08 来源:互联网 点击:

thURL:(NSURL *)url placeholderImage:(UIImage *)placeholder usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;

- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;

UIImage+Resize 调整图片大小

GitHub:https://github.com/coryalder/UIImage_Resize

提供多种方法为图片设置透明度、圆角、裁剪、调整大小等:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

- (UIImage *)imageWithAlpha;

- (UIImage *)transparentBorderImage:(NSUInteger)borderSize;

- (UIImage *)roundedCornerImage:(NSInteger)cornerSize borderSize:(NSInteger)borderSize;

- (UIImage *)croppedImage:(CGRect)bounds;

- (UIImage *)thumbnailImage:(NSInteger)thumbnailSize

transparentBorder:(NSUInteger)borderSize

cornerRadius:(NSUInteger)cornerRadius

interpolationQuality:(CGInterpolationQuality)quality;

- (UIImage *)resizedImage:(CGSize)newSize

interpolationQuality:(CGInterpolationQuality)quality;

- (UIImage *)

resizedImageWithContentMode:(UIViewContentMode)contentMode

bounds:(CGSize)bounds

interpolationQuality:(CGInterpolationQuality)quality;

更详细使用见:http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/

ImageCacheResize 异步加载图片、缓存及调整大小

GitHub:https://github.com/toptierlabs/ImageCacheResize

整合了SDWebImage和UIImage+Resize的功能,用于图片的异步加载、缓存、以及下载完成后调整大小并显示在UIImageView上。

提供了以下API用于加载图片以及加载完成后调整图片大小:

1

2

3

4

5

6

- (void)setImageWithURL:(NSURL *)url andCropToBounds:(CGRect)bounds;

- (void)setImageWithURL:(NSURL *)url andResize:(CGSize)size withContentMode:(UIViewContentMode)mode;

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder andCropToBounds:(CGRect)bounds;

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options andResize:(CGSize)size;

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options andResize:(CGSize)size withContentMode:(UIViewContentMode)mode;

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options andCropToBounds:(CGRect)bounds;

使用方法和SDWebImage一样简单,如以下官方例子:

1

2

[imageview setImageWithURL:[NSURL URLWithString:@http://t0.gstatic.com/images?q=tbn:ANd9GcQfraHpiabjEY8iDdBe9OUQYHMtwfuAv9ZRR0RYKuoVF_EpE8Fp5A] andResize:CGSizeMake(30, 30) withContentMode:UIViewContentModeScaleAspectFit]; // 按比例缩放

[imageview setImageWithURL:[NSURL URLWithString:@http://t0.gstatic.com/ima

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top