Reputation: 147
I want to show some labels on the screen and I want to make them look exactly like UIAlertView. How can I copy the appearance? Note that I don't care about any of the functionality of the alert view and just want the default appearance as it looks good. Common properties such as backgroundColor on UIAlertView is not set and also the properties of the CALayer don't show anything useful.
Any ideas?
Upvotes: 0
Views: 1733
Reputation: 331
Even though it's not the precise answer to your question, here are some open source alternatives to UIAlertView that would have let you do what you needed in first place.
https://github.com/rtecson/RTAlertView#Installation
https://github.com/lmcd/LMAlertView
There's probably a lot more too.
Upvotes: 0
Reputation: 288
What you're looking for is a Blur Effect. If you're target is iOS 8 and higher, you can use this to create blur views
UIBlurEffect* blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
effectView = [[UIVisualEffectView alloc] initWithEffect:blur];
effectView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
effectView.frame = self.bounds;
[self addSubview:effectView];
Note that you can use UIBlurEffectStyleExtraLight, UIBlurEffectStyleLight, UIBlurEffectStyleDark.
If you use a lower version of iOS, you've to use a custom class like FXBlurView.
Upvotes: 5