Skip to content

Commit 746923c

Browse files
committed
定制MenuItem
1 parent 285506d commit 746923c

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

MessageDisplayKit/Classes/Models/XHShareMenuItem.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
*/
2424
@property (nonatomic, copy) NSString *title;
2525

26+
@property (nonatomic, strong) UIColor *titleColor;
27+
28+
@property (nonatomic, strong) UIFont *titleFont;
29+
2630
/**
2731
* 根据正常图片和标题初始化一个Model对象
2832
*
@@ -34,4 +38,8 @@
3438
- (instancetype)initWithNormalIconImage:(UIImage *)normalIconImage
3539
title:(NSString *)title;
3640

41+
- (instancetype)initWithNormalIconImage:(UIImage *)normalIconImage
42+
title:(NSString *)title
43+
titleColor:(UIColor *)titleColor
44+
titleFont:(UIFont *)titleFont;
3745
@end

MessageDisplayKit/Classes/Models/XHShareMenuItem.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@ @implementation XHShareMenuItem
1212

1313
- (instancetype)initWithNormalIconImage:(UIImage *)normalIconImage
1414
title:(NSString *)title {
15+
return [self initWithNormalIconImage:normalIconImage title:title titleColor:nil titleFont:nil];
16+
}
17+
18+
- (instancetype)initWithNormalIconImage:(UIImage *)normalIconImage
19+
title:(NSString *)title
20+
titleColor:(UIColor *)titleColor
21+
titleFont:(UIFont *)titleFont {
1522
self = [super init];
1623
if (self) {
1724
self.normalIconImage = normalIconImage;
1825
self.title = title;
26+
self.titleColor = titleColor;
27+
self.titleFont = titleFont;
1928
}
2029
return self;
2130
}

0 commit comments

Comments
 (0)