-
Notifications
You must be signed in to change notification settings - Fork 186
/
PopMenuModel.m
61 lines (49 loc) · 1.78 KB
/
PopMenuModel.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
//
// PopMenuModel.m
// HyPopMenuView
//
// Created by Hy_Mac on 16/7/8.
// Copyright © 2016年 ouy.Aberi. All rights reserved.
//
#import "PopMenuButton.h"
#import "PopMenuModel.h"
@implementation PopMenuModel
+ (instancetype __nonnull)allocPopMenuModelWithImageNameString:(NSString* __nonnull)imageNameString
AtTitleString:(NSString* __nonnull)titleString
AtTextColor:(UIColor* __nonnull)textColor
AtTransitionType:(PopMenuTransitionType)transitionType
AtTransitionRenderingColor:(UIColor* __nullable)transitionRenderingColor
{
PopMenuModel* model = [[PopMenuModel alloc] init];
model.imageNameString = imageNameString;
model.titleString = titleString;
model.transitionType = transitionType;
model.transitionRenderingColor = transitionRenderingColor;
model.textColor = textColor;
[model _obj];
return model;
}
- (instancetype __nonnull)init
{
self = [super init];
if (self) {
self.transitionType = PopMenuTransitionTypeSystemApi;
}
return self;
}
- (void)setAutomaticIdentificationColor:(BOOL)automaticIdentificationColor
{
_automaticIdentificationColor = automaticIdentificationColor;
[_customView setValue:self forKey:@"model"];
}
- (void)_obj
{
PopMenuButton* button = [[PopMenuButton alloc] init];
button.model = self;
CGFloat buttonViewWidth = MIN(CGRectGetWidth([UIScreen mainScreen].bounds), CGRectGetHeight([UIScreen mainScreen].bounds)) / 3;
buttonViewWidth = buttonViewWidth - 10;
button.bounds = CGRectMake(0, 0, buttonViewWidth, buttonViewWidth);
button.layer.masksToBounds = true;
_customView = button;
}
@end