File tree Expand file tree Collapse file tree
SIAlertViewExample/SIAlertViewExample Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ typedef void(^SIAlertViewHandler)(SIAlertView *alertView);
5050
5151@property (nonatomic , readonly , getter = isVisible) BOOL visible;
5252
53+ @property (nonatomic , strong ) UIColor *viewBackgroundColor NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR;
5354@property (nonatomic , strong ) UIColor *titleColor NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR;
5455@property (nonatomic , strong ) UIColor *messageColor NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR;
5556@property (nonatomic , strong ) UIFont *titleFont NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR;
Original file line number Diff line number Diff line change @@ -172,6 +172,7 @@ + (void)initialize
172172 return ;
173173
174174 SIAlertView *appearance = [self appearance ];
175+ appearance.viewBackgroundColor = [UIColor whiteColor ];
175176 appearance.titleColor = [UIColor blackColor ];
176177 appearance.messageColor = [UIColor darkGrayColor ];
177178 appearance.titleFont = [UIFont boldSystemFontOfSize: 20 ];
@@ -883,6 +884,15 @@ - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
883884
884885#pragma mark - UIAppearance setters
885886
887+ - (void )setViewBackgroundColor : (UIColor *)viewBackgroundColor
888+ {
889+ if (_viewBackgroundColor == viewBackgroundColor) {
890+ return ;
891+ }
892+ _viewBackgroundColor = viewBackgroundColor;
893+ self.containerView .backgroundColor = viewBackgroundColor;
894+ }
895+
886896- (void )setTitleFont : (UIFont *)titleFont
887897{
888898 if (_titleFont == titleFont) {
Original file line number Diff line number Diff line change 99#import " ViewController.h"
1010#import " SIAlertView.h"
1111
12+ #define TEST_UIAPPEARANCE 0
13+
1214@interface ViewController ()
1315
1416@end
@@ -18,12 +20,14 @@ @implementation ViewController
1820- (void )viewDidLoad
1921{
2022 [super viewDidLoad ];
21-
23+ # if TEST_UIAPPEARANCE
2224 [[SIAlertView appearance ] setMessageFont: [UIFont systemFontOfSize: 13 ]];
2325 [[SIAlertView appearance ] setTitleColor: [UIColor greenColor ]];
2426 [[SIAlertView appearance ] setMessageColor: [UIColor purpleColor ]];
2527 [[SIAlertView appearance ] setCornerRadius: 12 ];
2628 [[SIAlertView appearance ] setShadowRadius: 20 ];
29+ [[SIAlertView appearance ] setViewBackgroundColor: [UIColor colorWithRed: 0.891 green: 0.936 blue: 0.978 alpha: 1.000 ]];
30+ #endif
2731}
2832
2933#pragma mark - Actions
You can’t perform that action at this time.
0 commit comments