@@ -16,7 +16,12 @@ +(instancetype) buttonWithTitle:(NSString *) title backgroundColor:(UIColor *) c
16
16
17
17
+(instancetype ) buttonWithTitle : (NSString *) title backgroundColor : (UIColor *) color padding : (NSInteger ) padding
18
18
{
19
- return [self buttonWithTitle: title icon: nil backgroundColor: color padding: padding];
19
+ return [self buttonWithTitle: title icon: nil backgroundColor: color insets: UIEdgeInsetsMake (0 , padding, 0 , padding)];
20
+ }
21
+
22
+ +(instancetype ) buttonWithTitle : (NSString *) title backgroundColor : (UIColor *) color insets : (UIEdgeInsets) insets
23
+ {
24
+ return [self buttonWithTitle: title icon: nil backgroundColor: color insets: insets];
20
25
}
21
26
22
27
+(instancetype ) buttonWithTitle : (NSString *) title backgroundColor : (UIColor *) color callback : (MGSwipeButtonCallback) callback
@@ -26,7 +31,12 @@ +(instancetype) buttonWithTitle:(NSString *) title backgroundColor:(UIColor *) c
26
31
27
32
+(instancetype ) buttonWithTitle : (NSString *) title backgroundColor : (UIColor *) color padding : (NSInteger ) padding callback : (MGSwipeButtonCallback) callback
28
33
{
29
- return [self buttonWithTitle: title icon: nil backgroundColor: color padding: padding callback: callback];
34
+ return [self buttonWithTitle: title icon: nil backgroundColor: color insets: UIEdgeInsetsMake (0 , padding, 0 , padding) callback: callback];
35
+ }
36
+
37
+ +(instancetype ) buttonWithTitle : (NSString *) title backgroundColor : (UIColor *) color insets : (UIEdgeInsets) insets callback : (MGSwipeButtonCallback) callback
38
+ {
39
+ return [self buttonWithTitle: title icon: nil backgroundColor: color insets: insets callback: callback];
30
40
}
31
41
32
42
+(instancetype ) buttonWithTitle : (NSString *) title icon : (UIImage*) icon backgroundColor : (UIColor *) color
@@ -36,7 +46,12 @@ +(instancetype) buttonWithTitle:(NSString *) title icon:(UIImage*) icon backgrou
36
46
37
47
+(instancetype ) buttonWithTitle : (NSString *) title icon : (UIImage*) icon backgroundColor : (UIColor *) color padding : (NSInteger ) padding
38
48
{
39
- return [self buttonWithTitle: title icon: icon backgroundColor: color padding: padding callback: nil ];
49
+ return [self buttonWithTitle: title icon: icon backgroundColor: color insets: UIEdgeInsetsMake (0 , padding, 0 , padding) callback: nil ];
50
+ }
51
+
52
+ +(instancetype ) buttonWithTitle : (NSString *) title icon : (UIImage*) icon backgroundColor : (UIColor *) color insets : (UIEdgeInsets) insets
53
+ {
54
+ return [self buttonWithTitle: title icon: icon backgroundColor: color insets: insets callback: nil ];
40
55
}
41
56
42
57
+(instancetype ) buttonWithTitle : (NSString *) title icon : (UIImage*) icon backgroundColor : (UIColor *) color callback : (MGSwipeButtonCallback) callback
@@ -45,6 +60,11 @@ +(instancetype) buttonWithTitle:(NSString *) title icon:(UIImage*) icon backgrou
45
60
}
46
61
47
62
+(instancetype ) buttonWithTitle : (NSString *) title icon : (UIImage*) icon backgroundColor : (UIColor *) color padding : (NSInteger ) padding callback : (MGSwipeButtonCallback) callback
63
+ {
64
+ return [self buttonWithTitle: title icon: icon backgroundColor: color insets: UIEdgeInsetsMake (0 , padding, 0 , padding) callback: callback];
65
+ }
66
+
67
+ +(instancetype ) buttonWithTitle : (NSString *) title icon : (UIImage*) icon backgroundColor : (UIColor *) color insets : (UIEdgeInsets) insets callback : (MGSwipeButtonCallback) callback
48
68
{
49
69
MGSwipeButton * button = [self buttonWithType: UIButtonTypeCustom];
50
70
button.backgroundColor = color;
@@ -54,7 +74,7 @@ +(instancetype) buttonWithTitle:(NSString *) title icon:(UIImage*) icon backgrou
54
74
[button setTitleColor: [UIColor whiteColor ] forState: UIControlStateNormal];
55
75
[button setImage: icon forState: UIControlStateNormal];
56
76
button.callback = callback;
57
- [button setPadding: padding ];
77
+ [button setEdgeInsets: insets ];
58
78
return button;
59
79
}
60
80
@@ -101,4 +121,10 @@ - (void)setButtonWidth:(CGFloat)buttonWidth
101
121
}
102
122
}
103
123
124
+ -(void ) setEdgeInsets : (UIEdgeInsets)insets
125
+ {
126
+ self.contentEdgeInsets = insets;
127
+ [self sizeToFit ];
128
+ }
129
+
104
130
@end
0 commit comments