diff --git a/LGAlertView.podspec b/LGAlertView.podspec index bd4c72b..0eea611 100644 --- a/LGAlertView.podspec +++ b/LGAlertView.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'LGAlertView' - s.version = '2.0.10' + s.version = '2.0.11' s.platform = :ios, '6.0' s.license = 'MIT' s.homepage = 'https://github.com/Friend-LGA/LGAlertView' diff --git a/LGAlertView/LGAlertView.m b/LGAlertView/LGAlertView.m index a0bc401..e99a49e 100644 --- a/LGAlertView/LGAlertView.m +++ b/LGAlertView/LGAlertView.m @@ -1356,6 +1356,38 @@ - (void)setButtonAtIndex:(NSUInteger)index enabled:(BOOL)enabled } } +- (void)setCancelButtonEnabled:(BOOL)cancelButtonEnabled +{ + _cancelButtonEnabled = cancelButtonEnabled; + + if (_cancelButtonTitle.length) + { + if (_tableView) + { + LGAlertViewCell *cell = (LGAlertViewCell *)[_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:(_buttonTitles.count-1) inSection:0]]; + cell.enabled = cancelButtonEnabled; + } + else if (_scrollView) + _cancelButton.enabled = cancelButtonEnabled; + } +} + +- (void)setDestructiveButtonEnabled:(BOOL)destructiveButtonEnabled +{ + _destructiveButtonEnabled = destructiveButtonEnabled; + + if (_destructiveButtonTitle.length) + { + if (_tableView) + { + LGAlertViewCell *cell = (LGAlertViewCell *)[_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; + cell.enabled = destructiveButtonEnabled; + } + else if (_scrollView) + _destructiveButton.enabled = destructiveButtonEnabled; + } +} + - (BOOL)isButtonEnabledAtIndex:(NSUInteger)index { return [_buttonsEnabledArray[index] boolValue];