Skip to content

Commit 82422ec

Browse files
committed
fixed bug with rating controller and textfield being added at the same time, added new feature for scaling image
1 parent a0c91ee commit 82422ec

File tree

6 files changed

+43
-27
lines changed

6 files changed

+43
-27
lines changed

Example/Pods/FCAlertView/FCAlertView/Classes/FCAlertView.h

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/FCAlertView/FCAlertView/Classes/FCAlertView.m

Lines changed: 14 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FCAlertView.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'FCAlertView'
11-
s.version = '1.2.5'
11+
s.version = '1.2.6'
1212
s.summary = 'FCAlertView is a Flat Customizable AlertView'
1313

1414
# This description is used to generate tags and improve search results.

FCAlertView/Classes/FCAlertView.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
UIButton *item5;
6464

6565
NSInteger currentRating;
66-
66+
6767
}
6868

6969
// Delegate
@@ -102,6 +102,7 @@
102102
@property BOOL detachButtons;
103103
@property BOOL fullCircleCustomImage;
104104
@property BOOL hideSeparatorLineView;
105+
@property CGFloat customImageScale;
105106

106107
// Default Types of Alerts
107108

FCAlertView/Classes/FCAlertView.m

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ - (id)init
6868
_detachButtons = NO;
6969
_fullCircleCustomImage = NO;
7070
_hideSeparatorLineView = NO;
71+
_customImageScale = 1;
7172

7273
defaultSpacing = [self configureAVWidth];
7374
defaultHeight = [self configureAVHeight];
@@ -151,7 +152,7 @@ - (void) checkCustomizationValid {
151152

152153
if (_subTitle == nil || [_subTitle isEqualToString:@""])
153154
if (_title == nil || [_title isEqualToString:@""])
154-
_subTitle = @"You need to have a title or subtitle to use FCAlertView 😀";
155+
NSLog(@"FCAlertView Warning: Your Alert should have a title and/or subtitle.");
155156

156157
if (doneTitle == nil || [doneTitle isEqualToString:@""]) {
157158
doneTitle = @"OK";
@@ -277,7 +278,7 @@ - (void)drawRect:(CGRect)rect {
277278
result.width - defaultSpacing,
278279
defaultHeight - 30);
279280

280-
if (self.title == nil) // Frames for when AlertView doesn't contain a title
281+
if (_title == nil || _title.length == 0) // Frames for when AlertView doesn't contain a title
281282
alertViewFrame = CGRectMake(self.frame.size.width/2 - ((result.width - defaultSpacing)/2),
282283
self.frame.size.height/2 - ((alertViewFrame.size.height - 50)/2),
283284
result.width - defaultSpacing,
@@ -334,7 +335,7 @@ - (void)drawRect:(CGRect)rect {
334335

335336
NSInteger descriptionLevel = 45.0f;
336337

337-
if (_title == nil) {
338+
if (_title == nil || _title.length == 0) {
338339

339340
descriptionLevel = 15.0f;
340341
alertViewFrame = CGRectMake(alertViewFrame.origin.x,
@@ -844,18 +845,20 @@ - (void)drawRect:(CGRect)rect {
844845
alertViewVector.image = [vectorImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
845846
}
846847

847-
if (_fullCircleCustomImage) {
848-
alertViewVector.frame = CGRectMake(alertViewContents.frame.size.width/2 - 30.0f,
849-
-30.0f,
850-
60.0f,
851-
60.0f);
852-
} else {
853-
alertViewVector.frame = CGRectMake(alertViewContents.frame.size.width/2 - 15.0f,
854-
-15.0f,
855-
30.0f,
856-
30.0f);
848+
if (_fullCircleCustomImage)
849+
_customImageScale = 2;
850+
851+
if (_customImageScale <= 0) {
852+
_customImageScale = 1;
857853
}
858854

855+
CGFloat vectorSize = 30.0f * MIN(2, _customImageScale);
856+
857+
alertViewVector.frame = CGRectMake(alertViewContents.frame.size.width/2 - (vectorSize/2),
858+
-(vectorSize/2) - 0.5,
859+
vectorSize,
860+
vectorSize);
861+
859862
alertViewVector.contentMode = UIViewContentModeScaleAspectFit;
860863
alertViewVector.userInteractionEnabled = 0;
861864
alertViewVector.tintColor = _colorScheme;
@@ -915,7 +918,7 @@ - (void)drawRect:(CGRect)rect {
915918
// ADDING RATING SYSTEM
916919

917920
ratingController = [[UIView alloc] initWithFrame:CGRectMake(20,
918-
descriptionLevel + descriptionLabelFrames.size.height + 32.5 + 15,
921+
descriptionLevel + descriptionLabelFrames.size.height + 32.5 + 15+ (MIN(1, alertTextFields.count)*(_textField.frame.size.height + 7.5)),
919922
alertViewFrame.size.width - 40,
920923
40)];
921924

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,14 @@ If you prefer the custom image for you alert to be full width of the image circl
334334
alert.fullCircleCustomImage = YES;
335335
```
336336

337+
### Custom Image Scaling
338+
339+
If you prefer the custom image for you alert to be scaled up or down to a certain size, use:
340+
341+
```Objective-C
342+
alert.customImageScale = 1.5; // Change 1.5 to how big or small you want to scale your custom alert image ranged from 0 to 2
343+
```
344+
337345
### Hiding Separator Lines
338346

339347
To hide the separator lines that appear between the done and custom buttons of the alert, add:

0 commit comments

Comments
 (0)