Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Friend-LGA committed Nov 10, 2015
1 parent 2a0a093 commit ad3383c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Demo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- LGAlertView (2.0.4)
- LGAlertView (2.0.5)

DEPENDENCIES:
- LGAlertView (from `../`)
Expand All @@ -9,6 +9,6 @@ EXTERNAL SOURCES:
:path: ../

SPEC CHECKSUMS:
LGAlertView: bd8c89da95f31a9bdeda279d9939629cbcbfaaca
LGAlertView: dffa2d6fd7b485bb9bee0c2bff29d71b77f318cb

COCOAPODS: 0.39.0
2 changes: 1 addition & 1 deletion LGAlertView.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'LGAlertView'
s.version = '2.0.4'
s.version = '2.0.5'
s.platform = :ios, '6.0'
s.license = 'MIT'
s.homepage = 'https://github.com/Friend-LGA/LGAlertView'
Expand Down
24 changes: 11 additions & 13 deletions LGAlertView/LGAlertView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,7 @@ - (void)setButtonAtIndex:(NSUInteger)index enabled:(BOOL)enabled

- (BOOL)isButtonEnabledAtIndex:(NSUInteger)index
{
return _buttonsEnabledArray[index];
return (BOOL)_buttonsEnabledArray[index];
}

- (void)setButtonPropertiesAtIndex:(NSUInteger)index
Expand All @@ -1350,17 +1350,15 @@ - (void)setButtonPropertiesAtIndex:(NSUInteger)index
if (!_buttonsPropertiesDictionary)
_buttonsPropertiesDictionary = [NSMutableDictionary new];

for (NSUInteger index=0; index<_buttonTitles.count; index++)
{
LGAlertViewButtonProperties *properties = [LGAlertViewButtonProperties new];
LGAlertViewButtonProperties *properties = _buttonsPropertiesDictionary[[NSNumber numberWithInteger:index]];
if (!properties) properties = [LGAlertViewButtonProperties new];

handler(properties);
handler(properties);

if (properties.isUserEnabled)
_buttonsEnabledArray[index] = [NSNumber numberWithBool:properties.enabled];
if (properties.isUserEnabled)
_buttonsEnabledArray[index] = [NSNumber numberWithBool:properties.enabled];

[_buttonsPropertiesDictionary setObject:properties forKey:[NSNumber numberWithInteger:index]];
}
[_buttonsPropertiesDictionary setObject:properties forKey:[NSNumber numberWithInteger:index]];
}
}

Expand Down Expand Up @@ -1459,7 +1457,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.lineBreakMode = (properties.isUserLineBreakMode ? properties.lineBreakMode : _buttonsLineBreakMode);
cell.adjustsFontSizeToFitWidth = (properties.isUserAdjustsFontSizeTofitWidth ? properties.adjustsFontSizeToFitWidth : _buttonsAdjustsFontSizeToFitWidth);
cell.minimumScaleFactor = (properties.isUserMinimimScaleFactor ? properties.minimumScaleFactor : _buttonsMinimumScaleFactor);
cell.enabled = _buttonsEnabledArray[indexPath.row - (_destructiveButtonTitle.length ? 1 : 0)];
cell.enabled = (BOOL)_buttonsEnabledArray[indexPath.row - (_destructiveButtonTitle.length ? 1 : 0)];
}

return cell;
Expand Down Expand Up @@ -2247,7 +2245,7 @@ - (void)subviewsInvalidateWithSize:(CGSize)size
_firstButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
else if (textAlignment == NSTextAlignmentRight)
_firstButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
_firstButton.enabled = _buttonsEnabledArray[0];
_firstButton.enabled = (BOOL)_buttonsEnabledArray[0];
[_firstButton addTarget:self action:@selector(firstButtonAction:) forControlEvents:UIControlEventTouchUpInside];

CGSize size = [_firstButton sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
Expand Down Expand Up @@ -2286,7 +2284,7 @@ - (void)subviewsInvalidateWithSize:(CGSize)size
_secondButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
else if (textAlignment == NSTextAlignmentRight)
_secondButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
_secondButton.enabled = _buttonsEnabledArray[1];
_secondButton.enabled = (BOOL)_buttonsEnabledArray[1];
[_secondButton addTarget:self action:@selector(secondButtonAction:) forControlEvents:UIControlEventTouchUpInside];

CGSize size = [_secondButton sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
Expand Down Expand Up @@ -2325,7 +2323,7 @@ - (void)subviewsInvalidateWithSize:(CGSize)size
_thirdButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
else if (textAlignment == NSTextAlignmentRight)
_thirdButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
_thirdButton.enabled = _buttonsEnabledArray[2];
_thirdButton.enabled = (BOOL)_buttonsEnabledArray[2];
[_thirdButton addTarget:self action:@selector(thirdButtonAction:) forControlEvents:UIControlEventTouchUpInside];

CGSize size = [_thirdButton sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
Expand Down

0 comments on commit ad3383c

Please sign in to comment.