您的位置:首页 > 产品设计 > UI/UE

iOS-UIKit( UIVisualEffectView.h - -解读)

2015-12-04 13:02 891 查看
<<UIVisualEffectView.h>>

/*

从iOS 7开始,苹果改变了App的UI风格和动画效果,例如当导航栏出现在屏幕上的效果。尤其是苹果在iOS7中,使用了全新的雾玻璃效果(模糊特

效)。不仅仅是导航栏,通知中心和控制中心也采用了这个特殊的视觉效果。

但是苹果并没有在SDK中放入这个特效,程序员不得不使用自己的方法在模拟这个效果,一直到iOS8的出现。

在iOS 8中,SDK中终于正式加入了这个特性,不但让程序员易于上手,而且性能表现也很优秀。苹果将之称为Visual
Effects(视觉效果)。

Visual Effects是一整套的视觉特效,包括了UIBlurEffect和UIVibrancyEffect。这两者都是UIVisualEffect的子类,前者允许在你App中动态地创建实时的雾玻璃效果,而后者则允许你在雾玻璃上“写字”。

*/

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

//3种不同的模糊效果:很亮、亮、暗色。

typedef NS_ENUM(NSInteger, UIBlurEffectStyle) {

UIBlurEffectStyleExtraLight, //偏白色

UIBlurEffectStyleLight,//模糊

UIBlurEffectStyleDark //偏黑色

} NS_ENUM_AVAILABLE_IOS(8_0);

//*****************UIVisualEffect类*******************

NS_CLASS_AVAILABLE_IOS(8_0)@interface UIVisualEffect :NSObject
<NSCopying,NSSecureCoding>
@end

//*********UIBlurEffect类(继承于UIVisualEffect,允许在你App中动态地创建实时的雾玻璃效果)*******

NS_CLASS_AVAILABLE_IOS(8_0)@interface UIBlurEffect :UIVisualEffect

+ (UIBlurEffect *)effectWithStyle:(UIBlurEffectStyle)style;//模糊效果

@end

//**********UIVibrancyEffect类(继承于UIVisualEffect,允许你在雾玻璃上“写字”)*********

NS_CLASS_AVAILABLE_IOS(8_0)@interface UIVibrancyEffect :
UIVisualEffect

+ (UIVibrancyEffect *)effectForBlurEffect:(UIBlurEffect *)blurEffect;

@end

//*********UIVisualEffectView类(UIVisualEffectView控件实现模糊特效)*************

NS_CLASS_AVAILABLE_IOS(8_0)@interface UIVisualEffectView :
UIView <NSSecureCoding>

@property (nonatomic,strong,
readonly)
UIView *contentView;// Do not add subviews directly to UIVisualEffectView, use this view instead.

@property (nonatomic,copy,
nullable)UIVisualEffect *effect;

- (instancetype)initWithEffect:(nullableUIVisualEffect *)effect
NS_DESIGNATED_INITIALIZER;

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoderNS_DESIGNATED_INITIALIZER;

@end

NS_ASSUME_NONNULL_END
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: