Skip to content

Commit

Permalink
Merge pull request #1 from nimati/master
Browse files Browse the repository at this point in the history
Merge from nimati/master
  • Loading branch information
digitalcatnip authored Jan 24, 2017
2 parents 7be9c35 + d9186e9 commit 3233b25
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 22 deletions.
1 change: 1 addition & 0 deletions Example/Pods/FCAlertView/FCAlertView/Classes/FCAlertView.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 31 additions & 10 deletions Example/Pods/FCAlertView/FCAlertView/Classes/FCAlertView.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion FCAlertView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'FCAlertView'
s.version = '1.2.8'
s.version = '1.2.9'
s.summary = 'FCAlertView is a Flat Customizable AlertView'

# This description is used to generate tags and improve search results.
Expand Down
3 changes: 2 additions & 1 deletion FCAlertView/Classes/FCAlertView.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ typedef void (^FCTextReturnBlock)(NSString *text);
@property (nonatomic, retain) UIColor * colorScheme;
@property (nonatomic, retain) UIColor * titleColor;
@property (nonatomic, retain) UIColor * subTitleColor;
@property (nonatomic, retain) UIColor *alertBackgroundColor;

@property (nonatomic, retain) UIColor * doneButtonTitleColor;

Expand Down Expand Up @@ -208,4 +209,4 @@ typedef void (^FCTextReturnBlock)(NSString *text);
- (void)FCAlertViewWillAppear:(FCAlertView *)alertView;
- (void)FCAlertDoneButtonClicked:(FCAlertView *)alertView;

@end
@end
41 changes: 31 additions & 10 deletions FCAlertView/Classes/FCAlertView.m
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ - (void)drawRect:(CGRect)rect {
// Re-adjusting Frames based on height of text - Requirement is to not have over 6 lines of text

CGSize constraint = CGSizeMake(descriptionLabel.frame.size.width, CGFLOAT_MAX);
CGSize sizeOfText;

NSStringDrawingContext *context = [[NSStringDrawingContext alloc] init];
CGSize boundingBox = [descriptionLabel.text boundingRectWithSize:constraint
Expand Down Expand Up @@ -416,7 +415,10 @@ - (void)drawRect:(CGRect)rect {
if (alertViewWithVector) {
alertView.backgroundColor = [UIColor clearColor];
} else {
alertView.backgroundColor = [UIColor whiteColor];
if (!self.alertBackgroundColor)
alertView.backgroundColor = [UIColor whiteColor];
else
alertView.backgroundColor = _alertBackgroundColor;
if (_darkTheme)
alertView.backgroundColor = [UIColor colorWithWhite:48.0f/255.0f alpha:1.0];
}
Expand All @@ -443,7 +445,10 @@ - (void)drawRect:(CGRect)rect {
CAShapeLayer *fillLayer = [CAShapeLayer layer];
fillLayer.path = rectPath.CGPath;
fillLayer.fillRule = kCAFillRuleEvenOdd;
fillLayer.fillColor = [UIColor whiteColor].CGColor;
if (!self.alertBackgroundColor)
fillLayer.fillColor = [UIColor whiteColor].CGColor;
else
fillLayer.fillColor = _alertBackgroundColor.CGColor;
if (_darkTheme)
fillLayer.fillColor = [UIColor colorWithWhite:48.0f/255.0f alpha:1.0].CGColor;
fillLayer.opacity = 1.0;
Expand Down Expand Up @@ -489,6 +494,10 @@ - (void)drawRect:(CGRect)rect {
_textField.layer.borderWidth = 1.0f;
_textField.delegate = self;
_textField.placeholder = [[alertTextFields firstObject] objectForKey:@"placeholder"];
if (self.darkTheme)
_textField.backgroundColor = [UIColor colorWithWhite:227.0f/255.0f alpha:1.0];
else
_textField.backgroundColor = [UIColor whiteColor];

UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 20)];
_textField.leftView = paddingView;
Expand Down Expand Up @@ -522,7 +531,7 @@ - (void)drawRect:(CGRect)rect {
alertViewFrame.size.height - 50,
alertViewFrame.size.width - 16,
40);
doneButton.layer.cornerRadius = self.cornerRadius;
doneButton.layer.cornerRadius = MIN(self.cornerRadius, doneButton.frame.size.height/2);
doneButton.layer.masksToBounds = YES;
}

Expand Down Expand Up @@ -561,7 +570,7 @@ - (void)drawRect:(CGRect)rect {
doneButton.frame.origin.y - 5,
doneButton.frame.size.width - 16,
40);
doneButton.layer.cornerRadius = self.cornerRadius;
doneButton.layer.cornerRadius = MIN(self.cornerRadius, doneButton.frame.size.height/2);
doneButton.layer.masksToBounds = YES;
}

Expand Down Expand Up @@ -599,7 +608,7 @@ - (void)drawRect:(CGRect)rect {
otherButton.frame.origin.y - 5,
otherButton.frame.size.width - 16,
40);
otherButton.layer.cornerRadius = self.cornerRadius;
otherButton.layer.cornerRadius = MIN(self.cornerRadius, otherButton.frame.size.height/2);
otherButton.layer.masksToBounds = YES;
}

Expand Down Expand Up @@ -675,7 +684,7 @@ - (void)drawRect:(CGRect)rect {
firstButton.frame.origin.y - 5,
firstButton.frame.size.width - 16,
40);
firstButton.layer.cornerRadius = self.cornerRadius;
firstButton.layer.cornerRadius = MIN(self.cornerRadius, firstButton.frame.size.height/2);
firstButton.layer.masksToBounds = YES;
}

Expand Down Expand Up @@ -718,7 +727,7 @@ - (void)drawRect:(CGRect)rect {
secondButton.frame.origin.y - 5,
secondButton.frame.size.width - 16,
40);
secondButton.layer.cornerRadius = self.cornerRadius;
secondButton.layer.cornerRadius = MIN(self.cornerRadius, secondButton.frame.size.height/2);
secondButton.layer.masksToBounds = YES;
}

Expand Down Expand Up @@ -757,7 +766,7 @@ - (void)drawRect:(CGRect)rect {
alertViewFrame.size.height - 50,
alertViewFrame.size.width - 16,
40);
doneButton.layer.cornerRadius = self.cornerRadius;
doneButton.layer.cornerRadius = MIN(self.cornerRadius, doneButton.frame.size.height/2);
doneButton.layer.masksToBounds = YES;
}

Expand Down Expand Up @@ -837,7 +846,10 @@ - (void)drawRect:(CGRect)rect {
if (!_fullCircleCustomImage) {
circleLayer = [CAShapeLayer layer];
[circleLayer setPath:[[UIBezierPath bezierPathWithOvalInRect:CGRectMake(alertViewContents.frame.size.width/2 - 30.0f, -30.0f, 60.0f, 60.0f)] CGPath]];
[circleLayer setFillColor:[UIColor whiteColor].CGColor];
if (!self.alertBackgroundColor)
[circleLayer setFillColor:[UIColor whiteColor].CGColor];
else
[circleLayer setFillColor:_alertBackgroundColor.CGColor];
}

if (_darkTheme)
Expand Down Expand Up @@ -1432,6 +1444,15 @@ - (void) dismissAlertView {
[backgroundVisualEffectView removeFromSuperview];
[self removeFromSuperview];
}];
} else {
id<FCAlertViewDelegate> strongDelegate = self.delegate;

if ([strongDelegate respondsToSelector:@selector(FCAlertViewDismissed:)]) {
[strongDelegate FCAlertViewDismissed:self];
}

[backgroundVisualEffectView removeFromSuperview];
[self removeFromSuperview];
}
}

Expand Down

0 comments on commit 3233b25

Please sign in to comment.