您的位置:首页 > 移动开发 > IOS开发

iOS系统自带毛玻璃效果

2016-03-03 10:34 525 查看
UIImageView
* imageview = [[UIImageView
alloc]
initWithImage:[UIImage
imageNamed:@"屏幕快照
2015-12-18
下午10.51.33"]];

imageview.userInteractionEnabled
=
YES;

imageview.contentMode
=
UIViewContentModeScaleAspectFit;

imageview.frame
=
CGRectMake(0,
0,
375,
668);

[self.view
addSubview:imageview];

UIBlurEffect * blur = [UIBlurEffect
effectWithStyle:UIBlurEffectStyleDark];

UIVisualEffectView * effectview = [[UIVisualEffectView
alloc]
initWithEffect:blur];

effectview.frame
=
CGRectMake(0,
0, imageview.frame.size.width,
imageview.frame.size.height);

[imageview
addSubview:effectview];

UIButton *button = [UIButton
buttonWithType:UIButtonTypeSystem];

button.frame
=
CGRectMake(10,
50,
60,
60);

[button
setTitle:@"btn"
forState:UIControlStateNormal];
[effectview.contentView
addSubview:button];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: