-
Notifications
You must be signed in to change notification settings - Fork 112
/
ChangeBoomButtonVC.m
85 lines (69 loc) · 2.59 KB
/
ChangeBoomButtonVC.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// ChangeBoomButtonVC.m
// VHBoomMenuButton
//
// Created by Nightonke on 2017/4/18.
// Copyright © 2017 Nightonke. All rights reserved.
//
#import "ChangeBoomButtonVC.h"
#import "BuilderManager.h"
#import <BoomMenuButton/BoomMenuButton.h>
@interface ChangeBoomButtonVC ()<VHBoomDelegate>
@property (weak, nonatomic) IBOutlet VHBoomMenuButton *bmb;
@end
@implementation ChangeBoomButtonVC
- (void)viewDidLoad
{
[super viewDidLoad];
self.bmb.buttonEnum = VHButtonHam;
self.bmb.piecePlaceEnum = VHPiecePlaceHAM_5;
self.bmb.buttonPlaceEnum = VHButtonPlaceHAM_5;
self.bmb.boomDelegate = self;
self.bmb.autoHide = NO;
VHHamButtonBuilder *builder;
[self.bmb addBuilder:[BuilderManager hamButtonBuilderWithText:@"Change Text" withSubText:@"..."]];
builder = [BuilderManager hamButtonBuilderWithText:@"Change Image" withSubText:@"..."];
builder.normalImageName = @"eagle";
[self.bmb addBuilder:builder];
builder = [BuilderManager hamButtonBuilderWithText:@"Change Color" withSubText:@"..."];
builder.normalColor = [UIColor blueColor];
[self.bmb addBuilder:builder];
[self.bmb addBuilder:[BuilderManager hamButtonBuilderWithText:@"Change Piece Color" withSubText:@"..."]];
builder = [BuilderManager hamButtonBuilderWithText:@"Change Unable" withSubText:@"..."];
builder.unableColor = [UIColor grayColor];
builder.unableImageName = @"butterfly";
builder.unableText = @"Unable!";
[self.bmb addBuilder:builder];
}
#pragma mark - VHBoomDelegate
- (void)boomMenuButton:(VHBoomMenuButton *)bmb didClickBoomButtonOfBuilder:(VHBoomButtonBuilder *)builder at:(int)index
{
VHHamButtonBuilder *hamBuilder = (VHHamButtonBuilder *)[self.bmb builder:index];
switch (index)
{
case 0:
hamBuilder.normalText = @"Changed!";
hamBuilder.highlightedText = @"Highlighted, changed!";
hamBuilder.normalSubText = @"Sub-text, changed!";
hamBuilder.normalTextColor = [UIColor yellowColor];
hamBuilder.highlightedColor = [UIColor purpleColor];
hamBuilder.normalSubTextColor = [UIColor blackColor];
break;
case 1:
hamBuilder.normalImageName = @"bat";
hamBuilder.highlightedImageName = @"bear";
break;
case 2:
hamBuilder.normalColor = [UIColor redColor];
break;
case 3:
hamBuilder.pieceColor = [UIColor whiteColor];
break;
case 4:
hamBuilder.unable = YES;
break;
default:
break;
}
}
@end