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,7 +50,8 @@ typedef void(^SIAlertViewHandler)(SIAlertView *alertView);
5050@property (nonatomic , strong ) UIFont *titleFont NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR;
5151@property (nonatomic , strong ) UIFont *messageFont NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR;
5252@property (nonatomic , strong ) UIFont *buttonFont NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR;
53- @property (nonatomic , assign ) CGFloat cornerRadius NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR;
53+ @property (nonatomic , assign ) CGFloat cornerRadius NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR; // default is 2.0
54+ @property (nonatomic , assign ) CGFloat shadowRadius NS_AVAILABLE_IOS (5_0) UI_APPEARANCE_SELECTOR; // default is 8.0
5455
5556- (id )initWithTitle : (NSString *)title andMessage : (NSString *)message ;
5657- (void )addButtonWithTitle : (NSString *)title type : (SIAlertViewButtonType)type handler : (SIAlertViewHandler)handler ;
Original file line number Diff line number Diff line change @@ -172,6 +172,7 @@ + (void)initialize
172172 appearance.messageFont = [UIFont systemFontOfSize: 16 ];
173173 appearance.buttonFont = [UIFont systemFontOfSize: [UIFont buttonFontSize ]];
174174 appearance.cornerRadius = 2 ;
175+ appearance.shadowRadius = 8 ;
175176}
176177
177178- (id )init
@@ -739,7 +740,7 @@ - (void)setupContainerView
739740 self.containerView .backgroundColor = [UIColor whiteColor ];
740741 self.containerView .layer .cornerRadius = self.cornerRadius ;
741742 self.containerView .layer .shadowOffset = CGSizeZero;
742- self.containerView .layer .shadowRadius = 8 ;
743+ self.containerView .layer .shadowRadius = self. shadowRadius ;
743744 self.containerView .layer .shadowOpacity = 0.5 ;
744745 [self addSubview: self .containerView];
745746}
@@ -927,4 +928,13 @@ - (void)setCornerRadius:(CGFloat)cornerRadius
927928 self.containerView .layer .cornerRadius = cornerRadius;
928929}
929930
931+ - (void )setShadowRadius : (CGFloat)shadowRadius
932+ {
933+ if (_shadowRadius == shadowRadius) {
934+ return ;
935+ }
936+ _shadowRadius = shadowRadius;
937+ self.containerView .layer .shadowRadius = shadowRadius;
938+ }
939+
930940@end
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ - (void)viewDidLoad
2323 [[SIAlertView appearance ] setTitleColor: [UIColor greenColor ]];
2424 [[SIAlertView appearance ] setMessageColor: [UIColor purpleColor ]];
2525 [[SIAlertView appearance ] setCornerRadius: 12 ];
26+ [[SIAlertView appearance ] setShadowRadius: 20 ];
2627}
2728
2829#pragma mark - Actions
You can’t perform that action at this time.
0 commit comments