diff --git a/README.md b/README.md index 8ea2a90..e9b32cc 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Animated Alert View written in Swift but ported to Objective-C, which can be use ![BackgroundImage](https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot.png)_ ![BackgroundImage](https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot2.png) -![BackgroundImage](https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot3.png) +![BackgroundImage](https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot3.png)_ ![BackgroundImage](https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot4.png) ![BackgroundImage](https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot5.png) diff --git a/SCLAlertView-Objective-C.podspec b/SCLAlertView-Objective-C.podspec index 1858615..f3c1f87 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.6.0" + spec.version = "0.6.1" 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" diff --git a/SCLAlertView/SCLAlertView.h b/SCLAlertView/SCLAlertView.h index 5b58fe0..0399750 100755 --- a/SCLAlertView/SCLAlertView.h +++ b/SCLAlertView/SCLAlertView.h @@ -111,14 +111,14 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground) /** Set Complete button format block. * * Holds the button format block. - * Support keys : backgroundColor, borderColor, textColor + * Support keys : backgroundColor, borderWidth, borderColor, textColor */ @property (nonatomic, copy) CompleteButtonFormatBlock completeButtonFormatBlock; /** Set button format block. * * Holds the button format block. - * Support keys : backgroundColor, borderColor, textColor + * Support keys : backgroundColor, borderWidth, borderColor, textColor */ @property (nonatomic, copy) ButtonFormatBlock buttonFormatBlock; @@ -162,6 +162,12 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground) */ @property (nonatomic, strong) UIColor *iconTintColor; +/** Set custom circle icon height. + * + * Circle icon height + */ +@property (nonatomic) CGFloat circleIconHeight; + /** Warns that alerts is gone * * Warns that alerts is gone using block diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index 90d1327..aadf265 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -40,7 +40,6 @@ @interface SCLAlertView () @property (nonatomic) CGFloat buttonsFontSize; @property (nonatomic) CGFloat windowHeight; @property (nonatomic) CGFloat windowWidth; -@property (nonatomic) CGFloat circleIconHeight; @property (nonatomic) CGFloat subTitleHeight; @property (nonatomic) CGFloat subTitleY; @@ -225,24 +224,26 @@ - (void)viewWillLayoutSubviews self.backgroundView.frame = newBackgroundFrame; // Set new main frame - CGRect newbaseFrame = self.view.frame; - newbaseFrame.size = sz; - self.view.frame = newbaseFrame; - - // Set frames + CGRect r; + if (self.view.superview != nil) { - CGFloat x = (sz.width - _windowWidth) / 2; - CGFloat y = (sz.height - _windowHeight - (kCircleHeight / 8)) / 2; - - _contentView.frame = CGRectMake(x, y, _windowWidth, _windowHeight); - y -= kCircleHeightBackground * 0.6f; - x = (sz.width - kCircleHeightBackground) / 2; - _circleViewBackground.frame = CGRectMake(x, y, kCircleHeightBackground, kCircleHeightBackground); - _circleIconImageView.frame = CGRectMake(kCircleHeight / 2 - _circleIconHeight / 2, kCircleHeight / 2 - _circleIconHeight / 2, _circleIconHeight, _circleIconHeight); + // View is showing, position at center of screen + r = CGRectMake((sz.width-_windowWidth)/2, (sz.height-_windowHeight)/2, _windowWidth, _windowHeight); + } + else + { + // View is not visible, position outside screen bounds + r = CGRectMake((sz.width-_windowWidth)/2, -_windowHeight, _windowWidth, _windowHeight); } - // Text fields + // Set frames + self.view.frame = r; + _contentView.frame = CGRectMake(0.0f, kCircleHeight / 4, _windowWidth, _windowHeight); + _circleViewBackground.frame = CGRectMake(_windowWidth / 2 - kCircleHeightBackground / 2, kCircleBackgroundTopPosition, kCircleHeightBackground, kCircleHeightBackground); + _circleIconImageView.frame = CGRectMake(kCircleHeight / 2 - _circleIconHeight / 2, kCircleHeight / 2 - _circleIconHeight / 2, _circleIconHeight, _circleIconHeight); + { + // Text fields CGFloat y = (_labelTitle.text == nil) ? (kCircleHeight - 20.0f) : 74.0f; y += _subTitleHeight + 14.0f; for (UITextField *textField in _inputs) diff --git a/SCLAlertView/SCLButton.h b/SCLAlertView/SCLButton.h index 24eabbd..90ca725 100644 --- a/SCLAlertView/SCLButton.h +++ b/SCLAlertView/SCLButton.h @@ -44,14 +44,14 @@ typedef NS_ENUM(NSInteger, SCLActionType) /** Set Complete button format block. * * Holds the complete button format block. - * Support keys : backgroundColor, borderColor, textColor + * Support keys : backgroundColor, borderWidth, borderColor, textColor */ @property (nonatomic, copy) CompleteButtonFormatBlock completeButtonFormatBlock; /** Set button format block. * * Holds the button format block. - * Support keys : backgroundColor, borderColor, textColor + * Support keys : backgroundColor, borderWidth, borderColor, textColor */ @property (nonatomic, copy) ButtonFormatBlock buttonFormatBlock; @@ -77,7 +77,7 @@ typedef NS_ENUM(NSInteger, SCLActionType) /** Parse button configuration * * Parse ButtonFormatBlock and CompleteButtonFormatBlock setting custom configuration. - * Set keys : backgroundColor, borderColor, textColor + * Set keys : backgroundColor, borderWidth, borderColor, textColor */ - (void)parseConfig:(NSDictionary *)buttonConfig;