I want add UIBlurEffect in UICollectionView ,but no effect,it only display the image normal;

My code

 UIImageView *backImageView = [[UIImageView alloc]initWithFrame:_discorverCollerction.bounds];
        backImageView.image = [UIImage imageNamed:@"sea.jpg"];

UIBlurEffect *beffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
UIVisualEffectView *effectview = [[UIVisualEffectView alloc]initWithEffect:beffect];
effectview.frame = backImageView.bounds;
[backImageView addSubview:effectview];

_discorverCollerction.backgroundView = backImageView;

Answers


I suspect your question to be "Why doesn't this work?".

Read the fine manual and see, you didn't use that right. Add the imageView to the UIVisualEffectView's contentView.

A UIVisualEffectView object gives you an easy way implement some complex visual effects. Depending on the desired effect, the effect may affect content layered behind the view or content added to the visual effect view’s contentView.

Apply a visual effect view to an existing view and then apply a UIBlurEffect or UIVibrancyEffect object to apply a blur or vibrancy effect to the existing view. After you add the visual effect view to the view hierarchy, add any subviews to the contentView property of the visual effect view. Do not add subviews directly to the visual effect view itself.


if (!UIAccessibilityIsReduceTransparencyEnabled()) {
    viewBlurr.backgroundColor = [UIColor clearColor];

    UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
    blurEffectView.frame = self.view.bounds;
    blurEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [viewBlurr addSubview:blurEffectView];
}

Need Your Help

HQL case statement returning entity object

hibernate hql case

I have a table of records (I've ommited setters and other attributes for simplicity):

Why do API's (like Facebook, last.fm etc) generate session keys for logged in users?

design-patterns api session facebook last.fm

I am building an RESTful API for an application I am working on and client coders need to be able to submit data to the API on behalf of a user. All the popular API's I've used require me to send the