Skip to content

Commit 5c8169b

Browse files
committed
add backgroundColor
1 parent 209d788 commit 5c8169b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

TYAlertControllerDemo/TYAlertController/TYAlertController.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ typedef NS_ENUM(NSInteger, TYAlertTransitionAnimation) {
2626

2727
@property (nonatomic, strong, readonly) UIView *alertView;
2828

29-
@property (nonatomic, strong) UIView *backgroundView; // set .backgroundColor,or you set coustom view to it
29+
@property (nonatomic, strong) UIColor *backgroundColor; // set backgroundColor
30+
@property (nonatomic, strong) UIView *backgroundView; // you set coustom view to it
3031

3132
@property (nonatomic, assign, readonly) TYAlertControllerStyle preferredStyle;
3233

TYAlertControllerDemo/TYAlertController/TYAlertController.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ - (void)addBackgroundView
125125
{
126126
if (_backgroundView == nil) {
127127
UIView *backgroundView = [[UIView alloc]init];
128-
backgroundView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4];
128+
backgroundView.backgroundColor = _backgroundColor;
129129
_backgroundView = backgroundView;
130130
}
131131
_backgroundView.translatesAutoresizingMaskIntoConstraints = NO;
@@ -169,12 +169,16 @@ - (void)setBackgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable
169169
_singleTap.enabled = backgoundTapDismissEnable;
170170
}
171171

172+
#pragma mark - configure
173+
172174
- (void)configureController
173175
{
174176
self.providesPresentationContextTransitionStyle = YES;
175177
self.definesPresentationContext = YES;
176178
self.modalPresentationStyle = UIModalPresentationCustom;
177179
self.transitioningDelegate = self;
180+
181+
_backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4];
178182
_backgoundTapDismissEnable = NO;
179183
_alertStyleEdging = 15;
180184
_actionSheetStyleEdging = 0;

0 commit comments

Comments
 (0)