UIBlurEffect實現模糊效果


  //使用圖片初始化背景  Pattern  圖案,模式
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"加載頁-6"]];
   
    //實現模糊效果
    //1.
    UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];  //Blur 模糊形狀,使模糊  Effect結果,效果
    //2.
    visualEffectView.frame = self.view.bounds;
    //3.
    visualEffectView.alpha = 0.5;
    //4.
    [self.view addSubview:visualEffectView];   //注意,不應該直接添加子視圖到UIVisualEffectView視圖中,而是應該添加到UIVisualEffectView對象的contentView中。
   
    //typedef NS_ENUM(NSInteger, UIBlurEffectStyle) {
    //    UIBlurEffectStyleExtraLight,   //extra   額外的
    //    UIBlurEffectStyleLight,
    //    UIBlurEffectStyleDark
    //} NS_ENUM_AVAILABLE_IOS(8_0);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM