iOS8 模糊视图(毛玻璃效果) UIVisualEffectView
2015-05-23 11:30
423 查看
在需要模糊的UIView上,添加一个UIVisualEffectView对象即可,若直接在storyboad里面直接加UIVisualEffectView,你的项目必须是iOS8以上才能用
- (void)viewDidLoad {
[super
viewDidLoad];
// UIImageView *imageview = [[UIImageView alloc] init];
//
// imageview.frame = CGRectMake(10, 200, 300, 300);
//
// imageview.image = [UIImage imageNamed:@"2"];
//
// imageview.contentMode = UIViewContentModeScaleAspectFit;
//
// imageview.userInteractionEnabled = YES;
//
// [self.view addSubview:imageview];
UIBlurEffect *blur = [UIBlurEffect
effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *effectview = [[UIVisualEffectView
alloc]
initWithEffect:blur];
// effectview.frame = CGRectMake(0, 0, imageview.frame.size.width/2, 300);
effectview.frame =
CGRectMake(0,
0, self.view.frame.size.width,
self.view.frame.size.height);
//[imageview addSubview:effectview];
[self.view
addSubview:effectview];
UIButton *btn = [UIButton
buttonWithType:UIButtonTypeSystem];
btn.frame =
CGRectMake(10,
50, 100,
40);
[btn setTitle:@"btn"
forState:UIControlStateNormal];
[effectview.contentView
addSubview:btn];
}
- (void)viewDidLoad {
[super
viewDidLoad];
// UIImageView *imageview = [[UIImageView alloc] init];
//
// imageview.frame = CGRectMake(10, 200, 300, 300);
//
// imageview.image = [UIImage imageNamed:@"2"];
//
// imageview.contentMode = UIViewContentModeScaleAspectFit;
//
// imageview.userInteractionEnabled = YES;
//
// [self.view addSubview:imageview];
UIBlurEffect *blur = [UIBlurEffect
effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *effectview = [[UIVisualEffectView
alloc]
initWithEffect:blur];
// effectview.frame = CGRectMake(0, 0, imageview.frame.size.width/2, 300);
effectview.frame =
CGRectMake(0,
0, self.view.frame.size.width,
self.view.frame.size.height);
//[imageview addSubview:effectview];
[self.view
addSubview:effectview];
UIButton *btn = [UIButton
buttonWithType:UIButtonTypeSystem];
btn.frame =
CGRectMake(10,
50, 100,
40);
[btn setTitle:@"btn"
forState:UIControlStateNormal];
[effectview.contentView
addSubview:btn];
}
相关文章推荐
- iOS8中用UIVisualEffectView实现高斯模糊视图(毛玻璃效果)
- iOS8中用UIVisualEffectView实现高斯模糊视图(毛玻璃效果)
- iOS 8 模糊视图(毛玻璃效果)的简单实现UIVisualEffectView
- iOS8中用UIVisualEffectView实现高斯模糊视图(毛玻璃效果)
- 模糊视图(毛玻璃效果) - UIVisualEffectView
- iOS 8 模糊视图(毛玻璃效果)的简单实现UIVisualEffectView
- iOS8模糊效果UIVisualEffectView的使用
- iOS8 只带毛玻璃效果API(UIVisualEffectView)
- iOS8 的毛玻璃效果(UIVisualEffectView)
- iOS8使用UIVisualEffectView实现模糊效果
- iOS UIVisualEffectView 为视图添加特殊毛玻璃的效果
- 图片模糊和背景视图设置毛玻璃效果
- iOS8使用UIVisualEffectView实现模糊效果
- iOS8 中 UIVisualEffectView 模糊效果的使用
- UIVisualEffectView(自定义模糊视图)
- CSS滤镜让图片模糊(毛玻璃效果)实例页面
- css 照片模糊效果(毛玻璃效果)
- MIUI 6的毛玻璃效果的技术实现(实时模糊)
- Android本地图片或者网络图片高斯模糊效果(毛玻璃效果)图片模糊效果一行代码搞定
- iOS开发中视图的下拉放大和上拉模糊的效果实现