你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> iOS 8 模糊視圖(毛玻璃效果)的簡單實現UIVisualEffectView

iOS 8 模糊視圖(毛玻璃效果)的簡單實現UIVisualEffectView

編輯:IOS開發綜合

在需要模糊的UIView上,添加一個UIVisualEffectView對象即可。

效果如下圖:

\



<喎?/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+tPrC68jnz8KjujwvcD4KPHA+PGJyPgo8L3A+CjxwPjwvcD4KPHA+CiAgICBVSUltYWdlVmlldyAqaW1hZ2V2aWV3ID0gW1tVSUltYWdlVmlldwphbGxvY10gCmluaXRdOzwvcD4KPHA+ICAgIGltYWdldmlldy5mcmFtZSA9CkNHUmVjdE1ha2UoMTAsCjEwMCwgMzAwLCAKMzAwKTs8L3A+CjxwPiAgICBpbWFnZXZpZXcuaW1hZ2UgPSBbVUlJbWFnZQppbWFnZU5hbWVkOkA="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.size.width/2, 300);

[imageview addSubview:effectview];

UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];

btn.frame = CGRectMake(10, 50, 100, 40);

[btn setTitle:@"btn" forState:UIControlStateNormal];

[effectview.contentView addSubview:btn];



iOS開發 swift技術交流QQ群361513739

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved