diff --git a/Demo/LCActionSheetDemo/ViewController.m b/Demo/LCActionSheetDemo/ViewController.m index e992485..2371d54 100644 --- a/Demo/LCActionSheetDemo/ViewController.m +++ b/Demo/LCActionSheetDemo/ViewController.m @@ -103,7 +103,7 @@ - (IBAction)showBlockActionSheet { NSMutableIndexSet *set = [[NSMutableIndexSet alloc] init]; [set addIndex:1]; [set addIndex:2]; - [actionSheet appendButtonsWithTitles:@[@"Hello", @"World"] atIndexes:set]; + [actionSheet appendButtonsWithTitles:@[@"Hello", @"World"] atIndexSet:set]; }); } diff --git a/README.md b/README.md index c56fc8f..a35e95e 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ In me the tiger sniffs the rose. NSMutableIndexSet *set = [[NSMutableIndexSet alloc] init]; [set addIndex:1]; [set addIndex:2]; - [actionSheet appendButtonsWithTitles:@[@"Hello", @"World"] atIndexes:set]; + [actionSheet appendButtonsWithTitles:@[@"Hello", @"World"] atIndexSet:set]; }); [actionSheet show]; @@ -283,37 +283,41 @@ In me the tiger sniffs the rose. ```objc @interface LCActionSheet : UIView - + // Append button at index with title. - (void)appendButtonWithTitle:(nullable NSString *)title atIndex:(NSUInteger)index; - + // Append buttons at indexes with titles. - - (void)appendButtonsWithTitles:(NSArray *)titles atIndexes:(NSIndexSet *)indexes; - + - (void)appendButtonsWithTitles:(NSArray *)titles atIndexSet:(NSIndexSet *)indexSet; + @end ``` * 修改属性类型: ```objc + @interface LCActionSheet : UIView + @property (nullable, nonatomic, strong) NSSet *destructiveButtonIndexSet; - + // -> - + @property (nullable, nonatomic, strong) NSIndexSet *destructiveButtonIndexSet; + + @end ``` * 修改方法命名: ```objc @interface LCActionSheet : UIView - + - (void)appendButtonTitles:(nullable NSString *)buttonTitles, ... NS_REQUIRES_NIL_TERMINATION; - + // -> - + - (void)appendButtonsWithTitles:(nullable NSString *)titles, ... NS_REQUIRES_NIL_TERMINATION; - + @end ``` diff --git a/Sources/LCActionSheet.h b/Sources/LCActionSheet.h index 2fecea1..a66c92d 100644 --- a/Sources/LCActionSheet.h +++ b/Sources/LCActionSheet.h @@ -376,10 +376,10 @@ typedef void(^LCActionSheetDidDismissHandler)(LCActionSheet *actionSheet, NSUInt /** Append buttons at indexes with titles. - @param titles titles - @param indexes indexes + @param titles titles + @param indexSet indexSet */ -- (void)appendButtonsWithTitles:(NSArray *)titles atIndexes:(NSIndexSet *)indexes; +- (void)appendButtonsWithTitles:(NSArray *)titles atIndexSet:(NSIndexSet *)indexSet; /** Show the instance of LCActionSheet. diff --git a/Sources/LCActionSheet.m b/Sources/LCActionSheet.m index 31ebcbc..4506851 100644 --- a/Sources/LCActionSheet.m +++ b/Sources/LCActionSheet.m @@ -389,16 +389,16 @@ - (void)appendButtonWithTitle:(NSString *)title atIndex:(NSUInteger)index { [self updateTableView]; } -- (void)appendButtonsWithTitles:(NSArray *)titles atIndexes:(NSIndexSet *)indexes { +- (void)appendButtonsWithTitles:(NSArray *)titles atIndexSet:(NSIndexSet *)indexSet { #ifdef DEBUG - NSAssert(titles.count == indexes.count, @"Count of titles differs from count of indexs"); + NSAssert(titles.count == indexSet.count, @"Count of titles differs from count of indexs"); #endif NSMutableIndexSet *indexSetM = [[NSMutableIndexSet alloc] init]; - [indexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { + [indexSet enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { #ifdef DEBUG NSAssert(idx != 0, @"Index 0 is cancel button"); - NSAssert(idx <= self.otherButtonTitles.count + indexes.count, @"Index crossed"); + NSAssert(idx <= self.otherButtonTitles.count + indexSet.count, @"Index crossed"); #endif [indexSetM addIndex:idx - 1];