ios 8 后使用uiblureffect 类和uivisualeffectview 类添加毛玻璃特效更加便捷,高效。
//创建imageview iimageview *imageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"5"]]; // 创建需要的毛玻璃特效类型 /** * uiblureffectstyleextralight, * uiblureffectstylelight, * uiblureffectstyledark */ uiblureffect *blur = [uiblureffect effectwithstyle:uiblureffectstyleextralight]; //添加到要有毛玻璃特效的控件中 uivisualeffectview *visual = [[uivisualeffectview alloc] initwitheffect:blur]; visual.frame = imageview.bounds; [self.view addsubview:imageview];
效果图:
原图:
(1) uiblureffectstyleextralight
(2) uiblureffectstylelight
(3) uiblureffectstyledark
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。
如对本文有疑问, 点击进行留言回复!!
出现The style on this component requires your app theme to be Theme.MaterialComponents错误
Codeforces Round #662 (Div. 2) D. Rarity and New Dress
CodeForces 1393C Pinkie Pie Eats Patty-cakes
网友评论