毛玻璃效果

import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    //添加照片
    UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
    UIImage *image=[UIImage imageNamed:@"headImage.png"];
    imageView.image=image;
    [self.window addSubview:imageView];

//毛玻璃效果  也可以给View,把View的背景颜色变淡了
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc]initWithEffect:effect];
visualEffectView.alpha = 0.9;
[visualEffectView setFrame:imageView.bounds];
[imageView addSubview:visualEffectView];




return YES;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • iOS开发中有的时候需要将图片设置模糊,来实现特定的效果获取更好的用户体验, iOS7之后半透明模糊效果得到大范围...
    零距离仰望星空阅读 46,637评论 47 223
  • 话说苹果在iOS7.0之后,很多系统界面都使用了毛玻璃效果,增加了界面的美观性,比如下图的通知中心界面; 效果图:...
    Mr_董阅读 1,320评论 0 0
  • *7月8日上午 N:Block :跟一个函数块差不多,会对里面所有的内容的引用计数+1,想要解决就用__block...
    炙冰阅读 2,553评论 1 14
  • 1.创建一个 UIToolbar 实例,设置它的 frame 或者也可以通过添加约束,然后 UIToolbar 有...
    米饭TT阅读 578评论 0 0
  • 1.UIPageController的使用 2.UIPageController可以作为其他控制器的子控制器,但是...
    峰子1994阅读 3,147评论 0 0