From 69cb8039ba62353f4c2695f2816860b85dc069c5 Mon Sep 17 00:00:00 2001 From: Diogo Autilio Date: Sun, 1 Feb 2015 21:37:18 -0200 Subject: [PATCH 1/5] Add customViewColor Add doc --- SCLAlertView/SCLAlertView.h | 6 ++++++ SCLAlertView/SCLAlertView.m | 6 ++++++ SCLAlertView/SCLButton.h | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/SCLAlertView/SCLAlertView.h b/SCLAlertView/SCLAlertView.h index 6898462..51a111d 100755 --- a/SCLAlertView/SCLAlertView.h +++ b/SCLAlertView/SCLAlertView.h @@ -136,6 +136,12 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground) */ @property (nonatomic) SCLAlertViewBackground backgroundType; +/** Set custom color to SCLAlertView. + * + * SCLAlertView custom color. + */ +@property (nonatomic, strong) UIColor *customViewColor; + /** Warns that alerts is gone * * Warns that alerts is gone using block diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index 49f07b4..bbc3104 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -571,6 +571,12 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag self.circleIconHeight *= 2.0f; break; } + + // Custom Alert color + if(_customViewColor) + { + viewColor = _customViewColor; + } // Title if([title stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length > 0) diff --git a/SCLAlertView/SCLButton.h b/SCLAlertView/SCLButton.h index 798df5f..be3c8ad 100644 --- a/SCLAlertView/SCLButton.h +++ b/SCLAlertView/SCLButton.h @@ -55,9 +55,9 @@ typedef NS_ENUM(NSInteger, SCLActionType) */ @property (nonatomic, copy) ButtonFormatBlock buttonFormatBlock; -/** TODO +/** Set SCLButton color. * - * TODO + * Set SCLButton color. */ @property (nonatomic, strong) UIColor *defaultBackgroundColor; From 75d774a5bb7d509c8ebf87fce6b426c092ebbee7 Mon Sep 17 00:00:00 2001 From: Diogo Autilio Date: Mon, 2 Feb 2015 08:54:08 -0200 Subject: [PATCH 2/5] Update readme --- README.md | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index dd967fe..65ca205 100644 --- a/README.md +++ b/README.md @@ -29,18 +29,6 @@ SCLAlertView *alert = [[SCLAlertView alloc] init]; [alert showCustom:self image:[UIImage imageNamed:@"git"] color:color title:@"Custom" subTitle:@"Add a custom icon and color for your own type of alert!" closeButtonTitle:@"OK" duration:0.0f]; // Custom ``` -###Advanced -```Objective-C -SCLAlertView *alert = [[SCLAlertView alloc] init]; - -[alert showTitle:self // Parent view controller - title:@"Congratulations" // Title of view - subTitle:@"Operation successfully completed." // String of view - style:Success // Styles - see below. - completeText:@"Done" // Optional button value - duration:2.0f]; // Duration to show before closing automatically -``` - ###Add buttons ```Objective-C SCLAlertView *alert = [[SCLAlertView alloc] init]; @@ -122,6 +110,9 @@ alert.showAnimationType = SlideInFromLeft; //Set background type (Default is Shadow) alert.backgroundType = Blur; +//Overwrite SCLAlertView default color +alert.customViewColor = [UIColor purpleColor]; + //Using sound alert.soundURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/right_answer.mp3", [[NSBundle mainBundle] resourcePath]]]; ``` From e9be3b005b12387591cecee4b406990ac275896d Mon Sep 17 00:00:00 2001 From: Diogo Autilio Date: Mon, 2 Feb 2015 10:29:23 -0200 Subject: [PATCH 3/5] Custom background color --- SCLAlertView/SCLAlertView.h | 7 +++++++ SCLAlertView/SCLAlertView.m | 21 ++++++++++++++------- SCLAlertViewExample/ViewController.m | 4 +++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/SCLAlertView/SCLAlertView.h b/SCLAlertView/SCLAlertView.h index 51a111d..0b26684 100755 --- a/SCLAlertView/SCLAlertView.h +++ b/SCLAlertView/SCLAlertView.h @@ -139,9 +139,16 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground) /** Set custom color to SCLAlertView. * * SCLAlertView custom color. + * (Buttons, circle and text field borders) */ @property (nonatomic, strong) UIColor *customViewColor; +/** Set custom color to SCLAlertView background. + * + * SCLAlertView background custom color. + */ +@property (nonatomic, strong) UIColor *backgroundViewColor; + /** Warns that alerts is gone * * Warns that alerts is gone using block diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index bbc3104..22e7375 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -134,9 +134,6 @@ - (instancetype)init _contentView.layer.masksToBounds = YES; _contentView.layer.borderWidth = 0.5f; - // Circle View Background - _circleViewBackground.backgroundColor = [UIColor whiteColor]; - // Background View _backgroundView.userInteractionEnabled = YES; @@ -160,10 +157,10 @@ - (instancetype)init } // Colors - _contentView.backgroundColor = [UIColor whiteColor]; - _labelTitle.textColor = UIColorFromRGB(0x4D4D4D); - _viewText.textColor = UIColorFromRGB(0x4D4D4D); - _contentView.layer.borderColor = UIColorFromRGB(0xCCCCCC).CGColor; + self.backgroundViewColor = [UIColor whiteColor]; + _labelTitle.textColor = UIColorFromRGB(0x4D4D4D); //Dark Grey + _viewText.textColor = UIColorFromRGB(0x4D4D4D); //Dark Grey + _contentView.layer.borderColor = UIColorFromRGB(0xCCCCCC).CGColor; //Light Grey } return self; } @@ -320,6 +317,16 @@ - (void)setButtonsTextFontFamily:(NSString *)buttonsFontFamily withSize:(CGFloat self.buttonsFontSize = size; } +#pragma mark - Background Color + +- (void)setBackgroundViewColor:(UIColor *)backgroundViewColor +{ + _backgroundViewColor = backgroundViewColor; + _circleViewBackground.backgroundColor = _backgroundViewColor; + _contentView.backgroundColor = _backgroundViewColor; + _viewText.backgroundColor = _backgroundViewColor; +} + #pragma mark - Sound - (void)setSoundURL:(NSURL *)soundURL diff --git a/SCLAlertViewExample/ViewController.m b/SCLAlertViewExample/ViewController.m index 95ebea0..1ea5056 100644 --- a/SCLAlertViewExample/ViewController.m +++ b/SCLAlertViewExample/ViewController.m @@ -117,6 +117,8 @@ - (IBAction)showAdvanced:(id)sender { SCLAlertView *alert = [[SCLAlertView alloc] init]; + alert.backgroundViewColor = [UIColor cyanColor]; + [alert setTitleFontFamily:@"Superclarendon" withSize:20.0f]; [alert setBodyTextFontFamily:@"TrebuchetMS" withSize:14.0f]; [alert setButtonsTextFontFamily:@"Baskerville" withSize:14.0f]; @@ -151,7 +153,7 @@ - (IBAction)showAdvanced:(id)sender [subTitle addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:redRange]; NSRange greenRange = [value rangeOfString:@"successfully" options:NSCaseInsensitiveSearch]; - [subTitle addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:greenRange]; + [subTitle addAttribute:NSForegroundColorAttributeName value:[UIColor brownColor] range:greenRange]; NSRange underline = [value rangeOfString:@"completed" options:NSCaseInsensitiveSearch]; [subTitle addAttributes:@{NSUnderlineStyleAttributeName:@(NSUnderlineStyleSingle)} range:underline]; From 63d17c1069c76b34371d6d99e4f5c5ce9c582841 Mon Sep 17 00:00:00 2001 From: Diogo Autilio Date: Mon, 2 Feb 2015 10:31:54 -0200 Subject: [PATCH 4/5] Update readme and doc --- README.md | 5 ++++- SCLAlertView/SCLAlertView.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 65ca205..3435c9a 100644 --- a/README.md +++ b/README.md @@ -110,9 +110,12 @@ alert.showAnimationType = SlideInFromLeft; //Set background type (Default is Shadow) alert.backgroundType = Blur; -//Overwrite SCLAlertView default color +//Overwrite SCLAlertView (Buttons, top circle and borders) colors alert.customViewColor = [UIColor purpleColor]; +//Overwrite SCLAlertView background color +alert.backgroundViewColor = [UIColor cyanColor]; + //Using sound alert.soundURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/right_answer.mp3", [[NSBundle mainBundle] resourcePath]]]; ``` diff --git a/SCLAlertView/SCLAlertView.h b/SCLAlertView/SCLAlertView.h index 0b26684..c7e00f4 100755 --- a/SCLAlertView/SCLAlertView.h +++ b/SCLAlertView/SCLAlertView.h @@ -139,7 +139,7 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground) /** Set custom color to SCLAlertView. * * SCLAlertView custom color. - * (Buttons, circle and text field borders) + * (Buttons, top circle and borders) */ @property (nonatomic, strong) UIColor *customViewColor; From 04f49d57695bf3f866045739effd5646cc1bbcbd Mon Sep 17 00:00:00 2001 From: Diogo Autilio Date: Mon, 2 Feb 2015 10:32:32 -0200 Subject: [PATCH 5/5] Bump version --- SCLAlertView-Objective-C.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SCLAlertView-Objective-C.podspec b/SCLAlertView-Objective-C.podspec index 5f5081f..4e198e3 100644 --- a/SCLAlertView-Objective-C.podspec +++ b/SCLAlertView-Objective-C.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "SCLAlertView-Objective-C" - spec.version = "0.5.2" + spec.version = "0.5.3" spec.summary = "Beautiful animated Alert View. Written in Swift but ported to Objective-C" spec.homepage = "https://github.com/dogo/SCLAlertView" spec.screenshots = "https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot.png", "https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot2.png"