-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathSimpleCircleButtonVC.m
77 lines (59 loc) · 2.31 KB
/
SimpleCircleButtonVC.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
//
// SimpleCircleButtonVC.m
// VHBoomMenuButton
//
// Created by Nightonke on 2017/4/11.
// Copyright © 2017 Nightonke. All rights reserved.
//
#import "SimpleCircleButtonVC.h"
#import "BuilderManager.h"
#import <BoomMenuButton/BoomMenuButton.h>
@interface SimpleCircleButtonVC ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) NSMutableArray<NSString *> *datas;
@property (nonatomic, strong) NSMutableArray<NSValue *> *piecesAndButtons;
@property (weak, nonatomic) IBOutlet VHBoomMenuButton *bmb;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@end
@implementation SimpleCircleButtonVC
#pragma mark - Initialize
- (void)viewDidLoad
{
[super viewDidLoad];
self.bmb.buttonEnum = VHButtonSimpleCircle;
[self initializeDatas];
[self tableView:self.tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
}
- (void)initializeDatas
{
self.datas = [NSMutableArray array];
self.piecesAndButtons = [NSMutableArray array];
[BuilderManager initializeDatasForSimpleCircleButton:self.datas piecesAndButtons:self.piecesAndButtons];
}
#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.bmb.piecePlaceEnum = [[self.piecesAndButtons objectAtIndex:indexPath.row] CGPointValue].x;
self.bmb.buttonPlaceEnum = [[self.piecesAndButtons objectAtIndex:indexPath.row] CGPointValue].y;
[self.bmb clearBuilders];
for (int i = 0; i < self.bmb.pieceNumber; i++)
{
[self.bmb addBuilder:[BuilderManager simpleCircleButtonBuilder]];
}
}
#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.datas.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *SimpleCircleButtonVCIdentifier = @"SimpleCircleButtonVCIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleCircleButtonVCIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleCircleButtonVCIdentifier];
}
cell.textLabel.text = [self.datas objectAtIndex:indexPath.row];
return cell;
}
@end