TYBlurImage 1.2.1

TYBlurImage 1.2.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2016年7月

luckytianyiyan 维护。




设置模糊效果并播放动画的简单方式。

示例

简单
Simple Example
UIImageView 播放模糊动画 UIImage 模糊效果
Play Aniamtion Example Effect Example

安装

Podfile

将以下内容添加到您的 Podfile。

pod 'TYBlurImage'

用法

API 文档可在 CocoaDocs - TYBlurImage 查找。

模糊效果

只需 #import UIImage+BlurEffects 头文件。

使用默认效果

调用以下方法可快速模糊。

  • ty_imageByApplyingLightEffectToImage
  • ty_imageByApplyingExtraLightEffectToImage
  • ty_imageByApplyingDarkEffectToImage
  • ty_imageByApplyingTintEffectWithColor: toImage
#import <UIImage+BlurEffects.h>

...

UIImage *sourceImage = [UIImage imageNamed:@"testImage.png"];
// Light Effect
UIImage *image = [UIImage ty_imageByApplyingLightEffectToImage:sourceImage];

使用基础方法

  • ty_imageByApplyingBlurToImage: withRadius: tintColor: saturationDeltaFactor: maskImage
CGFloat blurRadius = 20.f;
CGFloat saturationDeltaFactor = 1.2f;
UIColor *tintColor = [UIColor colorWithWhite:0.4f alpha:0.3f];
UIImage *image = [UIImage ty_imageByApplyingBlurToImage:sourceImage withRadius:blurRadius tintColor:tintColor saturationDeltaFactor:saturationDeltaFactor maskImage:nil];

UIImageView 动画

只需 #import UIImageView+BlurAnimation 头文件。

快速使用

UIImage *sourceImage = [UIImage imageNamed:@"testImage.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:sourceImage];
imageView.blurTintColor = [UIColor colorWithWhite:0.4f alpha:0.3f];
imageView.blurRadius = 20;
[imageView ty_blurInAnimationWithDuration:3.0f];

使用块

使用块,您可以在图像动画完成时收到通知。

[imageView ty_blurInAnimationWithDuration:3.0f completion:^{
    NSLog(@"complete");
}];

许可证

TYBlurImage 根据 MIT 许可证提供。有关更多信息,请参见 LICENSE 文件。