I've been trying to add a blur effect to my app and upon debugging it using breakpoints, the UIBlurEffect variable is always nil.
Following is the code I am using:
UIBlurEffect *effect = [[UIBlurEffect alloc] init];
effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *bluredView = [[UIVisualEffectView alloc] initWithEffect: effect];
bluredView.frame = self.view.bounds;
[self.view addSubview:bluredView];
I have tried a couple different things, for example instead of alloc and init UIBlurEffect, directly using it as follows:
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
It is still always set to nil. Is there an import I'm missing? I have imported UIKit in my .h file but 'effect' is always nil for some reason.
If anyone has experience the same, I would really appreciate it if you could share your experience.
Any help on the matter would be great! Thanks in advance!