Skip to content

Commit

Permalink
Update framework and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Friend-LGA committed Dec 26, 2016
1 parent c492030 commit 9575676
Show file tree
Hide file tree
Showing 5 changed files with 411 additions and 114 deletions.
6 changes: 4 additions & 2 deletions LGAlertView/LGAlertView.h
Original file line number Diff line number Diff line change
Expand Up @@ -859,9 +859,11 @@ typedef NS_ENUM(NSUInteger, LGAlertViewWindowLevel) {

+ (nonnull NSArray *)alertViewsArray;

#pragma mark -
#pragma mark - Unavailable

- (nonnull instancetype)initWithFrame:(CGRect)frame UNAVAILABLE_ATTRIBUTE;
- (nonnull instancetype)init __attribute__((unavailable("use -initWithTitle... instead")));
+ (nonnull instancetype)new __attribute__((unavailable("use +alertViewWithTitle... instead")));
- (nonnull instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("use -initWithTitle... instead")));

@end

Expand Down
48 changes: 24 additions & 24 deletions LGAlertView/LGAlertView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1441,8 +1441,8 @@ - (void)configCell:(LGAlertViewCell *)cell forRowAtIndexPath:(NSIndexPath *)inde

UIImage *image = nil;

if (properties.isUserImage) {
image = properties.image;
if (properties.isUserIconImage) {
image = properties.iconImage;
}
else if (self.buttonsIconImages.count > buttonIndex) {
image = self.buttonsIconImages[buttonIndex];
Expand All @@ -1452,8 +1452,8 @@ - (void)configCell:(LGAlertViewCell *)cell forRowAtIndexPath:(NSIndexPath *)inde

UIImage *imageHighlighted = nil;

if (properties.isUserImageHighlighted) {
imageHighlighted = properties.imageHighlighted;
if (properties.isUserIconImageHighlighted) {
imageHighlighted = properties.iconImageHighlighted;
}
else if (self.buttonsIconImagesHighlighted.count > buttonIndex) {
imageHighlighted = self.buttonsIconImagesHighlighted[buttonIndex];
Expand All @@ -1463,8 +1463,8 @@ - (void)configCell:(LGAlertViewCell *)cell forRowAtIndexPath:(NSIndexPath *)inde

UIImage *imageDisabled = nil;

if (properties.isUserImageDisabled) {
imageDisabled = properties.imageDisabled;
if (properties.isUserIconImageDisabled) {
imageDisabled = properties.iconImageDisabled;
}
else if (self.buttonsIconImagesDisabled.count > buttonIndex) {
imageDisabled = self.buttonsIconImagesDisabled[buttonIndex];
Expand Down Expand Up @@ -2272,8 +2272,8 @@ - (void)subviewsValidateWithSize:(CGSize)size {
forState:UIControlStateDisabled];

UIImage *image = nil;
if (properties.isUserImage) {
image = properties.image;
if (properties.isUserIconImage) {
image = properties.iconImage;
}
else if (self.buttonsIconImages.count > 0) {
image = self.buttonsIconImages[0];
Expand All @@ -2282,8 +2282,8 @@ - (void)subviewsValidateWithSize:(CGSize)size {
[self.firstButton setImage:image forState:UIControlStateNormal];

UIImage *imageHighlighted = nil;
if (properties.isUserImageHighlighted) {
imageHighlighted = properties.imageHighlighted;
if (properties.isUserIconImageHighlighted) {
imageHighlighted = properties.iconImageHighlighted;
}
else if (self.buttonsIconImagesHighlighted.count > 0) {
imageHighlighted = self.buttonsIconImagesHighlighted[0];
Expand All @@ -2293,8 +2293,8 @@ - (void)subviewsValidateWithSize:(CGSize)size {
[self.firstButton setImage:imageHighlighted forState:UIControlStateSelected];

UIImage *imageDisabled = nil;
if (properties.isUserImageDisabled) {
imageDisabled = properties.imageDisabled;
if (properties.isUserIconImageDisabled) {
imageDisabled = properties.iconImageDisabled;
}
else if (self.buttonsIconImagesDisabled.count > 0) {
imageDisabled = self.buttonsIconImagesDisabled[0];
Expand Down Expand Up @@ -2361,8 +2361,8 @@ - (void)subviewsValidateWithSize:(CGSize)size {
forState:UIControlStateDisabled];

UIImage *image = nil;
if (properties.isUserImage) {
image = properties.image;
if (properties.isUserIconImage) {
image = properties.iconImage;
}
else if (self.buttonsIconImages.count > 1) {
image = self.buttonsIconImages[1];
Expand All @@ -2371,8 +2371,8 @@ - (void)subviewsValidateWithSize:(CGSize)size {
[self.secondButton setImage:image forState:UIControlStateNormal];

UIImage *imageHighlighted = nil;
if (properties.isUserImageHighlighted) {
imageHighlighted = properties.imageHighlighted;
if (properties.isUserIconImageHighlighted) {
imageHighlighted = properties.iconImageHighlighted;
}
else if (self.buttonsIconImagesHighlighted.count > 1) {
imageHighlighted = self.buttonsIconImagesHighlighted[1];
Expand All @@ -2382,8 +2382,8 @@ - (void)subviewsValidateWithSize:(CGSize)size {
[self.secondButton setImage:imageHighlighted forState:UIControlStateSelected];

UIImage *imageDisabled = nil;
if (properties.isUserImageDisabled) {
imageDisabled = properties.imageDisabled;
if (properties.isUserIconImageDisabled) {
imageDisabled = properties.iconImageDisabled;
}
else if (self.buttonsIconImagesDisabled.count > 1) {
imageDisabled = self.buttonsIconImagesDisabled[1];
Expand Down Expand Up @@ -2450,8 +2450,8 @@ - (void)subviewsValidateWithSize:(CGSize)size {
forState:UIControlStateDisabled];

UIImage *image = nil;
if (properties.isUserImage) {
image = properties.image;
if (properties.isUserIconImage) {
image = properties.iconImage;
}
else if (self.buttonsIconImages.count > 2) {
image = self.buttonsIconImages[2];
Expand All @@ -2460,8 +2460,8 @@ - (void)subviewsValidateWithSize:(CGSize)size {
[self.thirdButton setImage:image forState:UIControlStateNormal];

UIImage *imageHighlighted = nil;
if (properties.isUserImageHighlighted) {
imageHighlighted = properties.imageHighlighted;
if (properties.isUserIconImageHighlighted) {
imageHighlighted = properties.iconImageHighlighted;
}
else if (self.buttonsIconImagesHighlighted.count > 2) {
imageHighlighted = self.buttonsIconImagesHighlighted[2];
Expand All @@ -2471,8 +2471,8 @@ - (void)subviewsValidateWithSize:(CGSize)size {
[self.thirdButton setImage:imageHighlighted forState:UIControlStateSelected];

UIImage *imageDisabled = nil;
if (properties.isUserImageDisabled) {
imageDisabled = properties.imageDisabled;
if (properties.isUserIconImageDisabled) {
imageDisabled = properties.iconImageDisabled;
}
else if (self.buttonsIconImagesDisabled.count > 2) {
imageDisabled = self.buttonsIconImagesDisabled[2];
Expand Down
12 changes: 6 additions & 6 deletions LGAlertView/LGAlertViewButtonProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
@property (strong, nonatomic, nullable) UIColor *backgroundColorHighlighted;
@property (strong, nonatomic, nullable) UIColor *backgroundColorDisabled;

@property (strong, nonatomic, nullable) UIImage *image;
@property (strong, nonatomic, nullable) UIImage *imageHighlighted;
@property (strong, nonatomic, nullable) UIImage *imageDisabled;
@property (strong, nonatomic, nullable) UIImage *iconImage;
@property (strong, nonatomic, nullable) UIImage *iconImageHighlighted;
@property (strong, nonatomic, nullable) UIImage *iconImageDisabled;

@property (assign, nonatomic) NSTextAlignment textAlignment;
@property (strong, nonatomic, nullable) UIFont *font;
Expand All @@ -60,9 +60,9 @@
@property (assign, nonatomic, readonly, getter=isUserBackgroundColor) BOOL userBackgroundColor;
@property (assign, nonatomic, readonly, getter=isUserBackgroundColorHighlighted) BOOL userBackgroundColorHighlighted;
@property (assign, nonatomic, readonly, getter=isUserBackgroundColorDisabled) BOOL userBackgroundColorDisabled;
@property (assign, nonatomic, readonly, getter=isUserImage) BOOL userImage;
@property (assign, nonatomic, readonly, getter=isUserImageHighlighted) BOOL userImageHighlighted;
@property (assign, nonatomic, readonly, getter=isUserImageDisabled) BOOL userImageDisabled;
@property (assign, nonatomic, readonly, getter=isUserIconImage) BOOL userIconImage;
@property (assign, nonatomic, readonly, getter=isUserIconImageHighlighted) BOOL userIconImageHighlighted;
@property (assign, nonatomic, readonly, getter=isUserIconImageDisabled) BOOL userIconImageDisabled;
@property (assign, nonatomic, readonly, getter=isUserTextAlignment) BOOL userTextAlignment;
@property (assign, nonatomic, readonly, getter=isUserFont) BOOL userFont;
@property (assign, nonatomic, readonly, getter=isUserNumberOfLines) BOOL userNumberOfLines;
Expand Down
36 changes: 18 additions & 18 deletions LGAlertView/LGAlertViewButtonProperties.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ @interface LGAlertViewButtonProperties ()
@property (readwrite) BOOL userBackgroundColor;
@property (readwrite) BOOL userBackgroundColorHighlighted;
@property (readwrite) BOOL userBackgroundColorDisabled;
@property (readwrite) BOOL userImage;
@property (readwrite) BOOL userImageHighlighted;
@property (readwrite) BOOL userImageDisabled;
@property (readwrite) BOOL userIconImage;
@property (readwrite) BOOL userIconImageHighlighted;
@property (readwrite) BOOL userIconImageDisabled;
@property (readwrite) BOOL userTextAlignment;
@property (readwrite) BOOL userFont;
@property (readwrite) BOOL userNumberOfLines;
Expand All @@ -62,9 +62,9 @@ - (id)initWithCoder:(NSCoder *)coder {
self.backgroundColor = [coder decodeObjectForKey:@"backgroundColor"];
self.backgroundColorHighlighted = [coder decodeObjectForKey:@"backgroundColorHighlighted"];
self.backgroundColorDisabled = [coder decodeObjectForKey:@"backgroundColorDisabled"];
self.image = [coder decodeObjectForKey:@"image"];
self.imageHighlighted = [coder decodeObjectForKey:@"imageHighlighted"];
self.imageDisabled = [coder decodeObjectForKey:@"imageDisabled"];
self.iconImage = [coder decodeObjectForKey:@"iconImage"];
self.iconImageHighlighted = [coder decodeObjectForKey:@"iconImageHighlighted"];
self.iconImageDisabled = [coder decodeObjectForKey:@"iconImageDisabled"];
self.font = [coder decodeObjectForKey:@"font"];
}
return self;
Expand All @@ -77,9 +77,9 @@ - (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject:self.backgroundColor forKey:@"backgroundColor"];
[coder encodeObject:self.backgroundColorHighlighted forKey:@"backgroundColorHighlighted"];
[coder encodeObject:self.backgroundColorDisabled forKey:@"backgroundColorDisabled"];
[coder encodeObject:self.image forKey:@"image"];
[coder encodeObject:self.imageHighlighted forKey:@"imageHighlighted"];
[coder encodeObject:self.imageDisabled forKey:@"imageDisabled"];
[coder encodeObject:self.iconImage forKey:@"iconImage"];
[coder encodeObject:self.iconImageHighlighted forKey:@"iconImageHighlighted"];
[coder encodeObject:self.iconImageDisabled forKey:@"iconImageDisabled"];
[coder encodeObject:self.font forKey:@"font"];
}

Expand Down Expand Up @@ -115,19 +115,19 @@ - (void)setBackgroundColorDisabled:(UIColor *)backgroundColorDisabled {
self.userBackgroundColorDisabled = YES;
}

- (void)setImage:(UIImage *)image {
_image = image;
self.userImage = YES;
- (void)setIconImage:(UIImage *)iconImage {
_iconImage = iconImage;
self.userIconImage = YES;
}

- (void)setImageHighlighted:(UIImage *)imageHighlighted {
_imageHighlighted = imageHighlighted;
self.userImageHighlighted = YES;
- (void)setIconImageHighlighted:(UIImage *)iconImageHighlighted {
_iconImageHighlighted = iconImageHighlighted;
self.userIconImageHighlighted = YES;
}

- (void)setImageDisabled:(UIImage *)imageDisabled {
_imageDisabled = imageDisabled;
self.userImageDisabled = YES;
- (void)seticonImageDisabled:(UIImage *)iconImageDisabled {
_iconImageDisabled = iconImageDisabled;
self.userIconImageDisabled = YES;
}

- (void)setTextAlignment:(NSTextAlignment)textAlignment {
Expand Down
Loading

0 comments on commit 9575676

Please sign in to comment.