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
/*
从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
相关文章推荐
- UINavigationController的popViewControllerAnimated的控制器移除问题
- 解决下载Android Build-tools 19.1.0失败
- 【iOS Programming: The Big Nerd Ranch Guide】【笔记】2
- UIResponder(iOS 常见的事件)
- UIResponder(iOS 常见的事件)
- 高仿大众点评7.9.0UI界面实现(附带源码)
- 获取UITableView的contentSize步骤
- 改变button的图片和文字位置 UIEdgeInsetsMake(, , ,
- Android中startActivity中的permission检测与UID机制
- UI基础学习的总结(—)视图
- iOS 视图在调用popToRootViewControllerAnimated:时uitabBar出现叠加
- FMDatabaseQueue嵌套查询导致卡死
- 快速理解RequireJs(转)
- iOS 8自动调整UITableView和UICollectionView布局
- easyui--numberBox
- UITextField文字缩进
- 关于Safari里quickOn绑定click事件闪屏问题的解决方案
- Frequently Asked Questions
- uefi怎么安装系统 UEFI+GTP模式安装Win7/Win8系统教程
- easyui-combo下拉框