Browse Source

Modify library AHKActionSheet

Marino Faggiana 8 years ago
parent
commit
266f3d42f7

+ 1 - 1
Libraries external/AHKActionSheet/AHKActionSheet.h

@@ -114,7 +114,7 @@ typedef void(^AHKActionSheetHandler)(AHKActionSheet *actionSheet);
  *  @param image   The image to display on the left of the title.
  *  @param handler A completion handler block to execute when a dismissal animation (after the user tapped on the button) has finished.
  */
-- (void)addButtonWithTitle:(NSString *)title image:(UIImage *)image backgroundColor:(UIColor *)backgroundColor type:(AHKActionSheetButtonType)type handler:(AHKActionSheetHandler)handler;
+- (void)addButtonWithTitle:(NSString *)title image:(UIImage *)image backgroundColor:(UIColor *)backgroundColor height:(CGFloat)height type:(AHKActionSheetButtonType)type handler:(AHKActionSheetHandler)handler;
 
 /// Displays the action sheet.
 - (void)show;

+ 6 - 3
Libraries external/AHKActionSheet/AHKActionSheet.m

@@ -35,6 +35,7 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
 @property (nonatomic) AHKActionSheetButtonType type;
 @property (strong, nonatomic) AHKActionSheetHandler handler;
 @property (nonatomic, strong) UIColor *backgroundColor;
+@property (nonatomic) CGFloat height;
 @end
 
 @implementation AHKActionSheetItem
@@ -193,7 +194,8 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
 
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    return self.buttonHeight;
+    AHKActionSheetItem *item = self.items[(NSUInteger)indexPath.row];
+    return item.height;
 }
 
 /*
@@ -270,15 +272,16 @@ static const CGFloat kCancelButtonShadowHeightRatio = 0.333f;
 
 - (void)addButtonWithTitle:(NSString *)title type:(AHKActionSheetButtonType)type handler:(AHKActionSheetHandler)handler
 {
-    [self addButtonWithTitle:title image:nil backgroundColor:[UIColor whiteColor] type:type handler:handler];
+    [self addButtonWithTitle:title image:nil backgroundColor:[UIColor whiteColor] height:self.buttonHeight type:type handler:handler];
 }
 
-- (void)addButtonWithTitle:(NSString *)title image:(UIImage *)image backgroundColor:(UIColor *)backgroundColor type:(AHKActionSheetButtonType)type handler:(AHKActionSheetHandler)handler
+- (void)addButtonWithTitle:(NSString *)title image:(UIImage *)image backgroundColor:(UIColor *)backgroundColor height:(CGFloat)height type:(AHKActionSheetButtonType)type handler:(AHKActionSheetHandler)handler
 {
     AHKActionSheetItem *item = [[AHKActionSheetItem alloc] init];
     item.title = title;
     item.image = image;
     item.backgroundColor = backgroundColor;
+    item.height = height;
     item.type = type;
     item.handler = handler;
     [self.items addObject:item];