Commit fa6fbd1eefbb4e30b97c23c7a02e03d93c7775b9
1 parent
f9503bf1
no message
Showing
6 changed files
with
37 additions
and
20 deletions
CNLiveCollectionModule/Assets/CNLiveCollectionModule.xcassets/collection_white_play.imageset/Contents.json
0 โ 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "idiom" : "universal", | ||
| 9 | + "filename" : "collection_white_play@2x.png", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "filename" : "collection_white_play@3x.png", | ||
| 15 | + "scale" : "3x" | ||
| 16 | + } | ||
| 17 | + ], | ||
| 18 | + "info" : { | ||
| 19 | + "version" : 1, | ||
| 20 | + "author" : "xcode" | ||
| 21 | + } | ||
| 22 | +} | ||
| 0 | \ No newline at end of file | 23 | \ No newline at end of file |
CNLiveCollectionModule/Assets/CNLiveCollectionModule.xcassets/collection_white_play.imageset/collection_white_play@2x.png
0 โ 100644
4.09 KB
CNLiveCollectionModule/Assets/CNLiveCollectionModule.xcassets/collection_white_play.imageset/collection_white_play@3x.png
0 โ 100644
8.33 KB
CNLiveCollectionModule/Classes/Model/CNLiveCollectionModel.h
| @@ -48,13 +48,9 @@ typedef NS_ENUM(NSInteger, CNLiveCollectionCellType) { | @@ -48,13 +48,9 @@ typedef NS_ENUM(NSInteger, CNLiveCollectionCellType) { | ||
| 48 | @property (nonatomic, copy) NSString *channelName; | 48 | @property (nonatomic, copy) NSString *channelName; |
| 49 | @property (nonatomic, copy) NSString *contentId; | 49 | @property (nonatomic, copy) NSString *contentId; |
| 50 | 50 | ||
| 51 | -@property (nonatomic, copy) NSMutableAttributedString *attributedString; | ||
| 52 | - | ||
| 53 | - | ||
| 54 | @property (nonatomic, copy) NSURL *imageUrl; | 51 | @property (nonatomic, copy) NSURL *imageUrl; |
| 55 | @property (nonatomic, copy) NSMutableAttributedString *title; | 52 | @property (nonatomic, copy) NSMutableAttributedString *title; |
| 56 | @property (nonatomic, copy) NSString *nameTime; | 53 | @property (nonatomic, copy) NSString *nameTime; |
| 57 | - | ||
| 58 | @property (nonatomic, assign) CGFloat height; | 54 | @property (nonatomic, assign) CGFloat height; |
| 59 | 55 | ||
| 60 | 56 |
CNLiveCollectionModule/Classes/Model/CNLiveCollectionModel.m
| @@ -18,19 +18,6 @@ | @@ -18,19 +18,6 @@ | ||
| 18 | }; | 18 | }; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | -- (void)setUpAttributedString{ | ||
| 22 | - NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; | ||
| 23 | - style.alignment = NSTextAlignmentLeft; | ||
| 24 | - style.lineBreakMode = NSLineBreakByTruncatingTail; | ||
| 25 | - NSDictionary *attributes = @{ NSFontAttributeName:UIFontCNMake(17), NSParagraphStyleAttributeName:style}; | ||
| 26 | - | ||
| 27 | -// NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithAttributedString:[CNTools replaceQQemojiWithCustomText:self.text ? self.text : @""]]; | ||
| 28 | -// [str setAttributes:attributes]; | ||
| 29 | - | ||
| 30 | -// YYTextContainer *textContainer = [YYTextContainer containerWithSize:CGSizeMake(MainScreenWidth() -(100*RATIO+50), CGFLOAT_MAX)]; | ||
| 31 | -// YYTextLayout *textLayout = [YYTextLayout layoutWithContainer:textContainer text:str]; | ||
| 32 | -// _attributedString = str; | ||
| 33 | -} | ||
| 34 | - (CGFloat)height{ | 21 | - (CGFloat)height{ |
| 35 | if ([self.type isEqualToString:@"1"]||[self.type isEqualToString:@"2"]||[self.type isEqualToString:@"3"]||[self.type isEqualToString:@"4"]) { | 22 | if ([self.type isEqualToString:@"1"]||[self.type isEqualToString:@"2"]||[self.type isEqualToString:@"3"]||[self.type isEqualToString:@"4"]) { |
| 36 | return 180; | 23 | return 180; |
| @@ -39,7 +26,13 @@ | @@ -39,7 +26,13 @@ | ||
| 39 | } | 26 | } |
| 40 | 27 | ||
| 41 | - (NSMutableAttributedString *)title{ | 28 | - (NSMutableAttributedString *)title{ |
| 42 | - return nil; | 29 | + NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; |
| 30 | + style.alignment = NSTextAlignmentLeft; | ||
| 31 | + style.lineBreakMode = NSLineBreakByTruncatingTail; | ||
| 32 | + NSDictionary *attributes = @{ NSFontAttributeName:UIFontCNMake(17), NSParagraphStyleAttributeName:style}; | ||
| 33 | + // NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithAttributedString:[CNTools replaceQQemojiWithCustomText:self.text ? self.text : @""]]; | ||
| 34 | + NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:self.text?self.text:@"" attributes:attributes]; | ||
| 35 | + return str; | ||
| 43 | } | 36 | } |
| 44 | 37 | ||
| 45 | - (NSString *)nameTime{ | 38 | - (NSString *)nameTime{ |
CNLiveCollectionModule/Classes/View/CNLiveCollectionCell.m
| @@ -91,6 +91,8 @@ static const NSInteger margin = 10; | @@ -91,6 +91,8 @@ static const NSInteger margin = 10; | ||
| 91 | _model = model; | 91 | _model = model; |
| 92 | [_leftImage sd_setImageWithURL:model.imageUrl placeholderImage:nil]; | 92 | [_leftImage sd_setImageWithURL:model.imageUrl placeholderImage:nil]; |
| 93 | 93 | ||
| 94 | + _titleLabel.attributedText = model.title; | ||
| 95 | + | ||
| 94 | _timeLabel.text = model.nameTime; | 96 | _timeLabel.text = model.nameTime; |
| 95 | 97 | ||
| 96 | _playerBtn.hidden = [model.videoId isEqualToString:@""]; | 98 | _playerBtn.hidden = [model.videoId isEqualToString:@""]; |
| @@ -128,7 +130,8 @@ static const NSInteger margin = 10; | @@ -128,7 +130,8 @@ static const NSInteger margin = 10; | ||
| 128 | if (!_leftImage) { | 130 | if (!_leftImage) { |
| 129 | _leftImage = [[UIImageView alloc] init]; | 131 | _leftImage = [[UIImageView alloc] init]; |
| 130 | _leftImage.userInteractionEnabled = YES; | 132 | _leftImage.userInteractionEnabled = YES; |
| 131 | - | 133 | + _leftImage.contentMode = UIViewContentModeScaleAspectFill; |
| 134 | + _leftImage.layer.masksToBounds = YES; | ||
| 132 | } | 135 | } |
| 133 | return _leftImage; | 136 | return _leftImage; |
| 134 | } | 137 | } |
| @@ -138,6 +141,9 @@ static const NSInteger margin = 10; | @@ -138,6 +141,9 @@ static const NSInteger margin = 10; | ||
| 138 | _titleLabel.textColor = [UIColor colorWithRed:40/255.0 green:40/255.0 blue:40/255.0 alpha:1.0]; | 141 | _titleLabel.textColor = [UIColor colorWithRed:40/255.0 green:40/255.0 blue:40/255.0 alpha:1.0]; |
| 139 | _titleLabel.font = UIFontCNMake(16); | 142 | _titleLabel.font = UIFontCNMake(16); |
| 140 | _titleLabel.userInteractionEnabled = YES; | 143 | _titleLabel.userInteractionEnabled = YES; |
| 144 | + _titleLabel.textAlignment = NSTextAlignmentLeft; | ||
| 145 | + _titleLabel.numberOfLines = 0; | ||
| 146 | + _titleLabel.lineBreakMode = NSLineBreakByTruncatingTail; | ||
| 141 | 147 | ||
| 142 | } | 148 | } |
| 143 | return _titleLabel; | 149 | return _titleLabel; |
| @@ -158,7 +164,7 @@ static const NSInteger margin = 10; | @@ -158,7 +164,7 @@ static const NSInteger margin = 10; | ||
| 158 | if (!_playerBtn) { | 164 | if (!_playerBtn) { |
| 159 | _playerBtn= [UIButton buttonWithType:UIButtonTypeCustom]; | 165 | _playerBtn= [UIButton buttonWithType:UIButtonTypeCustom]; |
| 160 | _playerBtn.adjustsImageWhenHighlighted = NO; | 166 | _playerBtn.adjustsImageWhenHighlighted = NO; |
| 161 | - UIImage *image = [self getImageWithImageName:@"collection_back_black_b" bundleName:@"CNLiveCollectionModule" targetClass:[self class]]; | 167 | + UIImage *image = [self getImageWithImageName:@"collection_white_play" bundleName:@"CNLiveCollectionModule" targetClass:[self class]]; |
| 162 | [_playerBtn setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; | 168 | [_playerBtn setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; |
| 163 | [_playerBtn addTarget:self action:@selector(playerDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | 169 | [_playerBtn addTarget:self action:@selector(playerDidClicked:) forControlEvents:UIControlEventTouchUpInside]; |
| 164 | } | 170 | } |