Commit 968eeddbf59f54be2f3eb0a8d1e201fcb02be936
1 parent
37481026
修复云测bug
Showing
28 changed files
with
120 additions
and
131 deletions
CNLiveCServiceModule.podspec
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | s.name = 'CNLiveCServiceModule' | 10 | s.name = 'CNLiveCServiceModule' |
| 11 | - s.version = '0.0.4' | 11 | + s.version = '0.0.5' |
| 12 | s.summary = '我的服务内容' | 12 | s.summary = '我的服务内容' |
| 13 | 13 | ||
| 14 | # This description is used to generate tags and improve search results. | 14 | # This description is used to generate tags and improve search results. |
CNLiveCServiceModule/Classes/Category/UIImage+CNBundleOrGredient.h
| @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN | @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 12 | @interface UIImage (CNBundleOrGredient) | 12 | @interface UIImage (CNBundleOrGredient) |
| 13 | 13 | ||
| 14 | // 创建一张渐变色图片 | 14 | // 创建一张渐变色图片 |
| 15 | -+ (UIImage *)gradientImageWithColors:(NSArray *)colors rect:(CGRect)rect; | 15 | ++ (UIImage *)gradientVerticalImageWithColors:(NSArray *)colors rect:(CGRect)rect; |
| 16 | +(UIImage *)loadCServiceBundle:(NSString *)imageName; | 16 | +(UIImage *)loadCServiceBundle:(NSString *)imageName; |
| 17 | 17 | ||
| 18 | @end | 18 | @end |
CNLiveCServiceModule/Classes/Category/UIImage+CNBundleOrGredient.m
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | return image; | 17 | return image; |
| 18 | } | 18 | } |
| 19 | // 创建一张渐变色图片 | 19 | // 创建一张渐变色图片 |
| 20 | -+ (UIImage *)gradientImageWithColors:(NSArray *)colors rect:(CGRect)rect{ | 20 | ++ (UIImage *)gradientVerticalImageWithColors:(NSArray *)colors rect:(CGRect)rect{ |
| 21 | if (!colors.count || CGRectEqualToRect(rect, CGRectZero)) { | 21 | if (!colors.count || CGRectEqualToRect(rect, CGRectZero)) { |
| 22 | return nil; | 22 | return nil; |
| 23 | } | 23 | } |
CNLiveCServiceModule/Classes/Present/CNLiveServicePresent.m
| @@ -42,7 +42,7 @@ static const CGFloat margin = 15; | @@ -42,7 +42,7 @@ static const CGFloat margin = 15; | ||
| 42 | } | 42 | } |
| 43 | } | 43 | } |
| 44 | }else{ | 44 | }else{ |
| 45 | - [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3]; | 45 | + [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:2]; |
| 46 | !failure?:failure(); | 46 | !failure?:failure(); |
| 47 | } | 47 | } |
| 48 | }]; | 48 | }]; |
| @@ -174,7 +174,7 @@ static const CGFloat margin = 15; | @@ -174,7 +174,7 @@ static const CGFloat margin = 15; | ||
| 174 | model = [CNLiveSearchModel mj_objectWithKeyValues:dic]; | 174 | model = [CNLiveSearchModel mj_objectWithKeyValues:dic]; |
| 175 | } | 175 | } |
| 176 | [categories addObject:model]; | 176 | [categories addObject:model]; |
| 177 | - if (num != 0 && (i != 0 || array.count == 1) &&(i%(num-1) == 0 || i == array.count - 1)) { | 177 | + if (num != 0 && (i != 0 || array.count == 1) &&((i + 1)%num == 0 || i == array.count - 1)) { |
| 178 | NSDictionary *category = @{ | 178 | NSDictionary *category = @{ |
| 179 | @"title":title, | 179 | @"title":title, |
| 180 | @"lists":categories.copy, | 180 | @"lists":categories.copy, |
| @@ -323,7 +323,8 @@ static const CGFloat margin = 15; | @@ -323,7 +323,8 @@ static const CGFloat margin = 15; | ||
| 323 | + (void)loadAllServiceWithServiceId:(NSString *)serviceId page:(nonnull NSString *)page result:(nonnull void (^)(NSArray * _Nonnull, BOOL))succeed error:(void (^)(void))failure | 323 | + (void)loadAllServiceWithServiceId:(NSString *)serviceId page:(nonnull NSString *)page result:(nonnull void (^)(NSArray * _Nonnull, BOOL))succeed error:(void (^)(void))failure |
| 324 | { | 324 | { |
| 325 | NSDictionary * params = @{@"sid": CNUserShareModelUid ? CNUserShareModelUid : @"", | 325 | NSDictionary * params = @{@"sid": CNUserShareModelUid ? CNUserShareModelUid : @"", |
| 326 | - @"categoryId":serviceId?serviceId:@"" | 326 | + @"categoryId":serviceId?serviceId:@"", |
| 327 | + @"page":page?page:@"" | ||
| 327 | }; | 328 | }; |
| 328 | 329 | ||
| 329 | [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | 330 | [CNLiveNetworking setAllowRequestDefaultArgument:YES]; |
CNLiveCServiceModule/Classes/View/CNLIveCategoryCell.m
| @@ -23,12 +23,12 @@ | @@ -23,12 +23,12 @@ | ||
| 23 | [self.contentView addSubview:self.titleLabel]; | 23 | [self.contentView addSubview:self.titleLabel]; |
| 24 | [self.contentView addSubview:self.subTitle]; | 24 | [self.contentView addSubview:self.subTitle]; |
| 25 | [self.contentView addSubview:self.rightImage]; | 25 | [self.contentView addSubview:self.rightImage]; |
| 26 | + [self makeSubViewsLayout]; | ||
| 26 | } | 27 | } |
| 27 | return self; | 28 | return self; |
| 28 | } | 29 | } |
| 29 | --(void)layoutSubviews | 30 | +-(void)makeSubViewsLayout |
| 30 | { | 31 | { |
| 31 | - [super layoutSubviews]; | ||
| 32 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { | 32 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 33 | make.left.equalTo(self.contentView).offset(15); | 33 | make.left.equalTo(self.contentView).offset(15); |
| 34 | make.centerY.equalTo(self.contentView); | 34 | make.centerY.equalTo(self.contentView); |
| @@ -59,7 +59,6 @@ | @@ -59,7 +59,6 @@ | ||
| 59 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; | 59 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; |
| 60 | self.titleLabel.text = model.title; | 60 | self.titleLabel.text = model.title; |
| 61 | self.subTitle.text = model.desc; | 61 | self.subTitle.text = model.desc; |
| 62 | - [self layoutSubviews]; | ||
| 63 | } | 62 | } |
| 64 | - (UIImageView *)logoView{ | 63 | - (UIImageView *)logoView{ |
| 65 | if (!_logoView) { | 64 | if (!_logoView) { |
CNLiveCServiceModule/Classes/View/CNLiveAlertTipView.m
| @@ -123,7 +123,7 @@ | @@ -123,7 +123,7 @@ | ||
| 123 | [_sureBtn setTitleColor:kWhiteColor forState:UIControlStateNormal]; | 123 | [_sureBtn setTitleColor:kWhiteColor forState:UIControlStateNormal]; |
| 124 | _sureBtn.layer.cornerRadius = 21; | 124 | _sureBtn.layer.cornerRadius = 21; |
| 125 | _sureBtn.titleLabel.font = UIFontMake(16); | 125 | _sureBtn.titleLabel.font = UIFontMake(16); |
| 126 | - _sureBtn.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientImageWithColors:@[CNLiveColorWithHexString(@"#FFAA4A"),CNLiveColorWithHexString(@"#EC5645")] rect:CGRectMake(0, 0, 120, 39)]]; | 126 | + _sureBtn.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientVerticalImageWithColors:@[CNLiveColorWithHexString(@"#FFAA4A"),CNLiveColorWithHexString(@"#EC5645")] rect:CGRectMake(0, 0, 120, 39)]]; |
| 127 | } | 127 | } |
| 128 | return _sureBtn; | 128 | return _sureBtn; |
| 129 | } | 129 | } |
CNLiveCServiceModule/Classes/View/CNLiveChineServiceCell.m
| @@ -21,12 +21,12 @@ | @@ -21,12 +21,12 @@ | ||
| 21 | [self.contentView addSubview:self.logoView]; | 21 | [self.contentView addSubview:self.logoView]; |
| 22 | [self.contentView addSubview:self.titleLabel]; | 22 | [self.contentView addSubview:self.titleLabel]; |
| 23 | [self.contentView addSubview:self.subTitle]; | 23 | [self.contentView addSubview:self.subTitle]; |
| 24 | + [self makeSubViewsLayout]; | ||
| 24 | } | 25 | } |
| 25 | return self; | 26 | return self; |
| 26 | } | 27 | } |
| 27 | --(void)layoutSubviews | 28 | +-(void)makeSubViewsLayout |
| 28 | { | 29 | { |
| 29 | - [super layoutSubviews]; | ||
| 30 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { | 30 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 31 | make.left.equalTo(self.contentView).offset(15); | 31 | make.left.equalTo(self.contentView).offset(15); |
| 32 | make.centerY.equalTo(self.contentView); | 32 | make.centerY.equalTo(self.contentView); |
| @@ -51,7 +51,6 @@ | @@ -51,7 +51,6 @@ | ||
| 51 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; | 51 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; |
| 52 | self.titleLabel.text = model.title; | 52 | self.titleLabel.text = model.title; |
| 53 | self.subTitle.text = model.desc; | 53 | self.subTitle.text = model.desc; |
| 54 | - [self layoutSubviews]; | ||
| 55 | } | 54 | } |
| 56 | - (UIImageView *)logoView{ | 55 | - (UIImageView *)logoView{ |
| 57 | if (!_logoView) { | 56 | if (!_logoView) { |
CNLiveCServiceModule/Classes/View/CNLiveCycleActiveCell.m
| @@ -19,10 +19,11 @@ | @@ -19,10 +19,11 @@ | ||
| 19 | if (self) { | 19 | if (self) { |
| 20 | [self.contentView addSubview:self.cycleView]; | 20 | [self.contentView addSubview:self.cycleView]; |
| 21 | self.collectionView.layer.cornerRadius = 9; | 21 | self.collectionView.layer.cornerRadius = 9; |
| 22 | + [self makeSubViewsLayout]; | ||
| 22 | } | 23 | } |
| 23 | return self; | 24 | return self; |
| 24 | } | 25 | } |
| 25 | -- (void)layoutSubviews | 26 | +-(void)makeSubViewsLayout |
| 26 | { | 27 | { |
| 27 | [super layoutSubviews]; | 28 | [super layoutSubviews]; |
| 28 | [self.cycleView mas_makeConstraints:^(MASConstraintMaker *make) { | 29 | [self.cycleView mas_makeConstraints:^(MASConstraintMaker *make) { |
| @@ -60,6 +61,7 @@ | @@ -60,6 +61,7 @@ | ||
| 60 | _cycleView.infiniteLoop = YES; | 61 | _cycleView.infiniteLoop = YES; |
| 61 | _cycleView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated; | 62 | _cycleView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated; |
| 62 | _cycleView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter; | 63 | _cycleView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter; |
| 64 | + _cycleView.contentMode = UIViewContentModeScaleAspectFit; | ||
| 63 | _cycleView.hidesForSinglePage = YES; | 65 | _cycleView.hidesForSinglePage = YES; |
| 64 | _cycleView.pageControlDotSize = CGSizeMake(4, 4); | 66 | _cycleView.pageControlDotSize = CGSizeMake(4, 4); |
| 65 | } | 67 | } |
CNLiveCServiceModule/Classes/View/CNLiveCycleCell.m
| @@ -28,10 +28,11 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; | @@ -28,10 +28,11 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; | ||
| 28 | self = [super initWithFrame:frame]; | 28 | self = [super initWithFrame:frame]; |
| 29 | if (self) { | 29 | if (self) { |
| 30 | [self.contentView addSubview:self.listCollectionView]; | 30 | [self.contentView addSubview:self.listCollectionView]; |
| 31 | + [self makeSubViewsLayout]; | ||
| 31 | } | 32 | } |
| 32 | return self; | 33 | return self; |
| 33 | } | 34 | } |
| 34 | -- (void)layoutSubviews | 35 | +-(void)makeSubViewsLayout |
| 35 | { | 36 | { |
| 36 | [super layoutSubviews]; | 37 | [super layoutSubviews]; |
| 37 | [self.listCollectionView mas_makeConstraints:^(MASConstraintMaker *make) { | 38 | [self.listCollectionView mas_makeConstraints:^(MASConstraintMaker *make) { |
CNLiveCServiceModule/Classes/View/CNLiveCycleView.m
| @@ -20,17 +20,13 @@ static NSString *CNCycleCellID = @"CNCycleCellID"; | @@ -20,17 +20,13 @@ static NSString *CNCycleCellID = @"CNCycleCellID"; | ||
| 20 | if (self) { | 20 | if (self) { |
| 21 | self.backgroundColor = kClearColor; | 21 | self.backgroundColor = kClearColor; |
| 22 | self.collectionView.dataSource = self; | 22 | self.collectionView.dataSource = self; |
| 23 | + [self makeSubViewsLayout]; | ||
| 23 | } | 24 | } |
| 24 | return self; | 25 | return self; |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 27 | -- (void)layoutSubviews | 28 | +-(void)makeSubViewsLayout |
| 28 | { | 29 | { |
| 29 | - [super layoutSubviews]; | ||
| 30 | - if ([_model.title isEqualToString:@""]) { | ||
| 31 | - return; | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | self.collectionView.frame = CGRectMake(0, 0, self.width, self.height - 20); | 30 | self.collectionView.frame = CGRectMake(0, 0, self.width, self.height - 20); |
| 35 | } | 31 | } |
| 36 | #pragma mark - UICollectionViewDataSource | 32 | #pragma mark - UICollectionViewDataSource |
CNLiveCServiceModule/Classes/View/CNLiveGoodsOrVideoHeaderView.m
| @@ -24,12 +24,12 @@ | @@ -24,12 +24,12 @@ | ||
| 24 | [self addSubview:self.titlelabel]; | 24 | [self addSubview:self.titlelabel]; |
| 25 | [self addSubview:self.subTitle]; | 25 | [self addSubview:self.subTitle]; |
| 26 | [self addSubview:self.moreBtn]; | 26 | [self addSubview:self.moreBtn]; |
| 27 | + [self makeSubViewsLayout]; | ||
| 27 | } | 28 | } |
| 28 | return self; | 29 | return self; |
| 29 | } | 30 | } |
| 30 | -- (void)layoutSubviews | 31 | +-(void)makeSubViewsLayout |
| 31 | { | 32 | { |
| 32 | - [super layoutSubviews]; | ||
| 33 | 33 | ||
| 34 | [self.LogoImage mas_makeConstraints:^(MASConstraintMaker *make) { | 34 | [self.LogoImage mas_makeConstraints:^(MASConstraintMaker *make) { |
| 35 | make.left.equalTo(self).offset(15); | 35 | make.left.equalTo(self).offset(15); |
| @@ -37,11 +37,7 @@ | @@ -37,11 +37,7 @@ | ||
| 37 | make.width.height.offset(16.5); | 37 | make.width.height.offset(16.5); |
| 38 | }]; | 38 | }]; |
| 39 | [self.titlelabel mas_makeConstraints:^(MASConstraintMaker *make) { | 39 | [self.titlelabel mas_makeConstraints:^(MASConstraintMaker *make) { |
| 40 | - if (!self.LogoImage.isHidden) { | ||
| 41 | - make.left.equalTo(_LogoImage.mas_right).offset(5); | ||
| 42 | - }else{ | ||
| 43 | - make.left.equalTo(self).offset(15); | ||
| 44 | - } | 40 | + make.left.equalTo(self).offset(15); |
| 45 | make.centerY.equalTo(self); | 41 | make.centerY.equalTo(self); |
| 46 | }]; | 42 | }]; |
| 47 | [self.subTitle mas_makeConstraints:^(MASConstraintMaker *make) { | 43 | [self.subTitle mas_makeConstraints:^(MASConstraintMaker *make) { |
| @@ -73,8 +69,12 @@ | @@ -73,8 +69,12 @@ | ||
| 73 | self.LogoImage.hidden = NO; | 69 | self.LogoImage.hidden = NO; |
| 74 | self.subTitle.hidden = NO; | 70 | self.subTitle.hidden = NO; |
| 75 | UIColor *begin = CNLiveColorWithHexString(@"#FFF4F1"); | 71 | UIColor *begin = CNLiveColorWithHexString(@"#FFF4F1"); |
| 76 | - self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientImageWithColors:@[begin,kWhiteColor] rect:self.bounds]]; | 72 | + self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientVerticalImageWithColors:@[begin,kWhiteColor] rect:self.bounds]]; |
| 77 | self.titlelabel.textColor = CNLiveColorWithHexString(@"#FA7256"); | 73 | self.titlelabel.textColor = CNLiveColorWithHexString(@"#FA7256"); |
| 74 | + [self.titlelabel mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 75 | + make.left.equalTo(self.LogoImage.mas_right).offset(5); | ||
| 76 | + make.centerY.equalTo(self); | ||
| 77 | + }]; | ||
| 78 | }else{ | 78 | }else{ |
| 79 | if ([pageModel.blockName isEqualToString:@"精品音频"]) { | 79 | if ([pageModel.blockName isEqualToString:@"精品音频"]) { |
| 80 | self.moreBtn.hidden = YES; | 80 | self.moreBtn.hidden = YES; |
| @@ -85,8 +85,11 @@ | @@ -85,8 +85,11 @@ | ||
| 85 | self.subTitle.hidden = YES; | 85 | self.subTitle.hidden = YES; |
| 86 | self.backgroundColor = kWhiteColor; | 86 | self.backgroundColor = kWhiteColor; |
| 87 | _titlelabel.textColor = CNLiveColorWithHexString(@"#333333"); | 87 | _titlelabel.textColor = CNLiveColorWithHexString(@"#333333"); |
| 88 | + [self.titlelabel mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 89 | + make.left.equalTo(self).offset(15); | ||
| 90 | + make.centerY.equalTo(self); | ||
| 91 | + }]; | ||
| 88 | } | 92 | } |
| 89 | - [self setNeedsLayout]; | ||
| 90 | } | 93 | } |
| 91 | - (UIImageView *)LogoImage | 94 | - (UIImageView *)LogoImage |
| 92 | { | 95 | { |
CNLiveCServiceModule/Classes/View/CNLiveHotSaleCell.h deleted
100644 → 0
CNLiveCServiceModule/Classes/View/CNLiveHotSaleCell.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveHotSaleCell.m | ||
| 3 | -// CNLiveCServiceModule | ||
| 4 | -// | ||
| 5 | -// Created by CNLive on 2021/11/27. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -#import "CNLiveHotSaleCell.h" | ||
| 9 | - | ||
| 10 | -@implementation CNLiveHotSaleCell | ||
| 11 | - | ||
| 12 | -- (void)awakeFromNib { | ||
| 13 | - [super awakeFromNib]; | ||
| 14 | - // Initialization code | ||
| 15 | -} | ||
| 16 | - | ||
| 17 | -- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | ||
| 18 | - [super setSelected:selected animated:animated]; | ||
| 19 | - | ||
| 20 | - // Configure the view for the selected state | ||
| 21 | -} | ||
| 22 | - | ||
| 23 | -@end |
CNLiveCServiceModule/Classes/View/CNLiveRecommendCell.m
| @@ -17,12 +17,12 @@ static NSString *CNVideoRecommendCellID = @"CNLiveVideoRecommendCell"; | @@ -17,12 +17,12 @@ static NSString *CNVideoRecommendCellID = @"CNLiveVideoRecommendCell"; | ||
| 17 | self = [super initWithFrame:frame]; | 17 | self = [super initWithFrame:frame]; |
| 18 | if (self) { | 18 | if (self) { |
| 19 | [self.contentView addSubview:self.listCollectionView]; | 19 | [self.contentView addSubview:self.listCollectionView]; |
| 20 | + [self makeSubViewsLayout]; | ||
| 20 | } | 21 | } |
| 21 | return self; | 22 | return self; |
| 22 | } | 23 | } |
| 23 | -- (void)layoutSubviews | 24 | +- (void)makeSubViewsLayout |
| 24 | { | 25 | { |
| 25 | - [super layoutSubviews]; | ||
| 26 | [self.listCollectionView mas_makeConstraints:^(MASConstraintMaker *make) { | 26 | [self.listCollectionView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 27 | make.left.right.top.bottom.equalTo(self); | 27 | make.left.right.top.bottom.equalTo(self); |
| 28 | }]; | 28 | }]; |
CNLiveCServiceModule/Classes/View/CNLiveSearchHeaderView.m
| @@ -20,13 +20,12 @@ | @@ -20,13 +20,12 @@ | ||
| 20 | self.backgroundColor = kWhiteColor; | 20 | self.backgroundColor = kWhiteColor; |
| 21 | [self addSubview:self.lineView]; | 21 | [self addSubview:self.lineView]; |
| 22 | [self addSubview:self.titlelabel]; | 22 | [self addSubview:self.titlelabel]; |
| 23 | - | 23 | + [self makeSubViewsLayout]; |
| 24 | } | 24 | } |
| 25 | return self; | 25 | return self; |
| 26 | } | 26 | } |
| 27 | -- (void)layoutSubviews | 27 | +- (void)makeSubViewsLayout |
| 28 | { | 28 | { |
| 29 | - [super layoutSubviews]; | ||
| 30 | [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { | 29 | [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 31 | make.left.equalTo(self); | 30 | make.left.equalTo(self); |
| 32 | make.centerY.equalTo(self); | 31 | make.centerY.equalTo(self); |
| @@ -55,7 +54,7 @@ | @@ -55,7 +54,7 @@ | ||
| 55 | _model = model; | 54 | _model = model; |
| 56 | if (_type == CNServiceHeaderTypeCategoryId) { | 55 | if (_type == CNServiceHeaderTypeCategoryId) { |
| 57 | self.lineView.hidden = NO; | 56 | self.lineView.hidden = NO; |
| 58 | - self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientImageWithColors:@[CNLiveColorWithHexString(@"#FEF2E0"),kWhiteColor] rect:self.bounds]]; | 57 | + self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientVerticalImageWithColors:@[CNLiveColorWithHexString(@"#FEF2E0"),kWhiteColor] rect:self.bounds]]; |
| 59 | NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@/正在使用",model.title]]; | 58 | NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@/正在使用",model.title]]; |
| 60 | [string addAttribute:NSFontAttributeName value:UIFontMake(12) range:NSMakeRange(0, string.length)]; | 59 | [string addAttribute:NSFontAttributeName value:UIFontMake(12) range:NSMakeRange(0, string.length)]; |
| 61 | [string addAttribute:NSFontAttributeName value:UIFontMake(17) range:NSMakeRange(0, model.title.length)]; | 60 | [string addAttribute:NSFontAttributeName value:UIFontMake(17) range:NSMakeRange(0, model.title.length)]; |
| @@ -67,7 +66,6 @@ | @@ -67,7 +66,6 @@ | ||
| 67 | self.titlelabel.text = model.title; | 66 | self.titlelabel.text = model.title; |
| 68 | } | 67 | } |
| 69 | [self.titlelabel sizeToFit]; | 68 | [self.titlelabel sizeToFit]; |
| 70 | - [self setNeedsLayout]; | ||
| 71 | } | 69 | } |
| 72 | - (UIView *)lineView | 70 | - (UIView *)lineView |
| 73 | { | 71 | { |
CNLiveCServiceModule/Classes/View/CNLiveSearchHistoryCell.m
| @@ -18,15 +18,16 @@ | @@ -18,15 +18,16 @@ | ||
| 18 | if (self) { | 18 | if (self) { |
| 19 | self.contentView.backgroundColor = CNLiveColorWithHexString(@"#F9F9F9"); | 19 | self.contentView.backgroundColor = CNLiveColorWithHexString(@"#F9F9F9"); |
| 20 | [self.contentView addSubview:self.history]; | 20 | [self.contentView addSubview:self.history]; |
| 21 | + [self makeSubViewsLayout]; | ||
| 21 | } | 22 | } |
| 22 | return self; | 23 | return self; |
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | --(void)layoutSubviews | 26 | +- (void)makeSubViewsLayout |
| 26 | { | 27 | { |
| 27 | - [super layoutSubviews]; | ||
| 28 | [self.history mas_makeConstraints:^(MASConstraintMaker *make) { | 28 | [self.history mas_makeConstraints:^(MASConstraintMaker *make) { |
| 29 | make.center.equalTo(self.contentView); | 29 | make.center.equalTo(self.contentView); |
| 30 | + make.left.right.equalTo(self); | ||
| 30 | }]; | 31 | }]; |
| 31 | } | 32 | } |
| 32 | 33 | ||
| @@ -34,8 +35,6 @@ | @@ -34,8 +35,6 @@ | ||
| 34 | - (void)setModel:(CNLiveHistoryModel *)model | 35 | - (void)setModel:(CNLiveHistoryModel *)model |
| 35 | { | 36 | { |
| 36 | self.history.text = model.title; | 37 | self.history.text = model.title; |
| 37 | - [self.history sizeToFit]; | ||
| 38 | - [self setNeedsLayout]; | ||
| 39 | } | 38 | } |
| 40 | - (UILabel *)history | 39 | - (UILabel *)history |
| 41 | { | 40 | { |
| @@ -43,6 +42,7 @@ | @@ -43,6 +42,7 @@ | ||
| 43 | _history = [[UILabel alloc] init]; | 42 | _history = [[UILabel alloc] init]; |
| 44 | _history.font = UIFontMake(12); | 43 | _history.font = UIFontMake(12); |
| 45 | _history.textColor = CNLiveColorWithHexString(@"#4A4A4A"); | 44 | _history.textColor = CNLiveColorWithHexString(@"#4A4A4A"); |
| 45 | + _history.textAlignment = NSTextAlignmentCenter; | ||
| 46 | } | 46 | } |
| 47 | return _history; | 47 | return _history; |
| 48 | } | 48 | } |
CNLiveCServiceModule/Classes/View/CNLiveSearchHotsCell.m
| @@ -18,12 +18,12 @@ | @@ -18,12 +18,12 @@ | ||
| 18 | if (self) { | 18 | if (self) { |
| 19 | [self.contentView addSubview:self.logoView]; | 19 | [self.contentView addSubview:self.logoView]; |
| 20 | [self.contentView addSubview:self.titleLabel]; | 20 | [self.contentView addSubview:self.titleLabel]; |
| 21 | + [self makeSubViewsLayout]; | ||
| 21 | } | 22 | } |
| 22 | return self; | 23 | return self; |
| 23 | } | 24 | } |
| 24 | --(void)layoutSubviews | 25 | +- (void)makeSubViewsLayout |
| 25 | { | 26 | { |
| 26 | - [super layoutSubviews]; | ||
| 27 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { | 27 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 28 | make.top.equalTo(self.contentView).offset(0); | 28 | make.top.equalTo(self.contentView).offset(0); |
| 29 | make.centerX.equalTo(self.contentView); | 29 | make.centerX.equalTo(self.contentView); |
| @@ -42,7 +42,6 @@ | @@ -42,7 +42,6 @@ | ||
| 42 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; | 42 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; |
| 43 | self.titleLabel.text = model.title; | 43 | self.titleLabel.text = model.title; |
| 44 | [self.titleLabel sizeToFit]; | 44 | [self.titleLabel sizeToFit]; |
| 45 | - [self layoutSubviews]; | ||
| 46 | } | 45 | } |
| 47 | - (UIImageView *)logoView{ | 46 | - (UIImageView *)logoView{ |
| 48 | if (!_logoView) { | 47 | if (!_logoView) { |
CNLiveCServiceModule/Classes/View/CNLiveSearchHotsFooterView.m
| @@ -20,12 +20,12 @@ | @@ -20,12 +20,12 @@ | ||
| 20 | self.backgroundColor = kWhiteColor; | 20 | self.backgroundColor = kWhiteColor; |
| 21 | [self addSubview:self.line]; | 21 | [self addSubview:self.line]; |
| 22 | [self addSubview:self.clearBtn]; | 22 | [self addSubview:self.clearBtn]; |
| 23 | + [self makeSubViewsLayout]; | ||
| 23 | } | 24 | } |
| 24 | return self; | 25 | return self; |
| 25 | } | 26 | } |
| 26 | -- (void)layoutSubviews | 27 | +- (void)makeSubViewsLayout |
| 27 | { | 28 | { |
| 28 | - [super layoutSubviews]; | ||
| 29 | [self.line mas_makeConstraints:^(MASConstraintMaker *make) { | 29 | [self.line mas_makeConstraints:^(MASConstraintMaker *make) { |
| 30 | make.top.equalTo(self); | 30 | make.top.equalTo(self); |
| 31 | make.left.equalTo(self).offset(15); | 31 | make.left.equalTo(self).offset(15); |
CNLiveCServiceModule/Classes/View/CNLiveSearchListCell.m
| @@ -23,10 +23,11 @@ | @@ -23,10 +23,11 @@ | ||
| 23 | [self.contentView addSubview:self.logoView]; | 23 | [self.contentView addSubview:self.logoView]; |
| 24 | [self.contentView addSubview:self.titleLabel]; | 24 | [self.contentView addSubview:self.titleLabel]; |
| 25 | [self.contentView addSubview:self.line]; | 25 | [self.contentView addSubview:self.line]; |
| 26 | + [self makeSubViewsLayout]; | ||
| 26 | } | 27 | } |
| 27 | return self; | 28 | return self; |
| 28 | } | 29 | } |
| 29 | -- (void)layoutSubviews | 30 | +- (void)makeSubViewsLayout |
| 30 | { | 31 | { |
| 31 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { | 32 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 32 | make.top.left.equalTo(self.contentView).offset(15); | 33 | make.top.left.equalTo(self.contentView).offset(15); |
| @@ -56,7 +57,6 @@ | @@ -56,7 +57,6 @@ | ||
| 56 | [attrString addAttribute:NSForegroundColorAttributeName value:color range:range]; | 57 | [attrString addAttribute:NSForegroundColorAttributeName value:color range:range]; |
| 57 | self.titleLabel.attributedText = attrString; | 58 | self.titleLabel.attributedText = attrString; |
| 58 | [self.titleLabel sizeToFit]; | 59 | [self.titleLabel sizeToFit]; |
| 59 | - [self setNeedsLayout]; | ||
| 60 | } | 60 | } |
| 61 | - (UIImageView *)logoView{ | 61 | - (UIImageView *)logoView{ |
| 62 | if (!_logoView) { | 62 | if (!_logoView) { |
CNLiveCServiceModule/Classes/View/CNLiveServiceChinasCell.m
| @@ -18,12 +18,12 @@ | @@ -18,12 +18,12 @@ | ||
| 18 | self = [super initWithFrame:frame]; | 18 | self = [super initWithFrame:frame]; |
| 19 | if (self) { | 19 | if (self) { |
| 20 | [self.contentView addSubview:self.cycleView]; | 20 | [self.contentView addSubview:self.cycleView]; |
| 21 | + [self makeSubViewsLayout]; | ||
| 21 | } | 22 | } |
| 22 | return self; | 23 | return self; |
| 23 | } | 24 | } |
| 24 | --(void)layoutSubviews | 25 | +- (void)makeSubViewsLayout |
| 25 | { | 26 | { |
| 26 | - [super layoutSubviews]; | ||
| 27 | [self.cycleView mas_makeConstraints:^(MASConstraintMaker *make) { | 27 | [self.cycleView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 28 | make.top.bottom.equalTo(self.contentView); | 28 | make.top.bottom.equalTo(self.contentView); |
| 29 | make.left.equalTo(self.contentView).offset(15); | 29 | make.left.equalTo(self.contentView).offset(15); |
CNLiveCServiceModule/Classes/View/CNLiveServiceEpiCell.m
| @@ -29,13 +29,13 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; | @@ -29,13 +29,13 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; | ||
| 29 | [self.contentView addSubview:self.travelBtn]; | 29 | [self.contentView addSubview:self.travelBtn]; |
| 30 | [self.leftImageView addSubview:self.titleLabel]; | 30 | [self.leftImageView addSubview:self.titleLabel]; |
| 31 | [self.leftImageView addSubview:self.listCollectionView]; | 31 | [self.leftImageView addSubview:self.listCollectionView]; |
| 32 | + [self makeSubViewsLayout]; | ||
| 32 | } | 33 | } |
| 33 | return self; | 34 | return self; |
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | -- (void)layoutSubviews | 37 | +- (void)makeSubViewsLayout |
| 37 | { | 38 | { |
| 38 | - [super layoutSubviews]; | ||
| 39 | [self.leftImageView mas_makeConstraints:^(MASConstraintMaker *make) { | 39 | [self.leftImageView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 40 | make.top.equalTo(self.contentView); | 40 | make.top.equalTo(self.contentView); |
| 41 | make.left.equalTo(self.contentView).offset(10); | 41 | make.left.equalTo(self.contentView).offset(10); |
| @@ -89,7 +89,7 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; | @@ -89,7 +89,7 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; | ||
| 89 | } | 89 | } |
| 90 | #pragma mark - UICollectionViewDelegateFlowLayout | 90 | #pragma mark - UICollectionViewDelegateFlowLayout |
| 91 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ | 91 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ |
| 92 | - return CGSizeMake(collectionView.width, (collectionView.height -10)/3); | 92 | + return CGSizeMake(collectionView.width, (collectionView.height -20)/3); |
| 93 | } | 93 | } |
| 94 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ | 94 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ |
| 95 | return UIEdgeInsetsMake(0, 0, 0, 0); | 95 | return UIEdgeInsetsMake(0, 0, 0, 0); |
| @@ -105,7 +105,6 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; | @@ -105,7 +105,6 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; | ||
| 105 | [self.travelBtn sd_setImageWithURL:[NSURL URLWithString:pageModel1.poster] forState:UIControlStateNormal]; | 105 | [self.travelBtn sd_setImageWithURL:[NSURL URLWithString:pageModel1.poster] forState:UIControlStateNormal]; |
| 106 | self.titleLabel.text = model.blockName; | 106 | self.titleLabel.text = model.blockName; |
| 107 | [_titleLabel sizeToFit]; | 107 | [_titleLabel sizeToFit]; |
| 108 | - [self setNeedsLayout]; | ||
| 109 | [self.listCollectionView reloadData]; | 108 | [self.listCollectionView reloadData]; |
| 110 | } | 109 | } |
| 111 | - (UIImageView *)leftImageView | 110 | - (UIImageView *)leftImageView |
CNLiveCServiceModule/Classes/View/CNLiveServiceLookCell.m
| @@ -24,13 +24,13 @@ | @@ -24,13 +24,13 @@ | ||
| 24 | [self.backImage addSubview:self.titleLabel]; | 24 | [self.backImage addSubview:self.titleLabel]; |
| 25 | [self.backImage addSubview:self.subTitlelabel]; | 25 | [self.backImage addSubview:self.subTitlelabel]; |
| 26 | [self.backImage addSubview:self.cycleView]; | 26 | [self.backImage addSubview:self.cycleView]; |
| 27 | + [self makeSubViewsLayout]; | ||
| 27 | 28 | ||
| 28 | } | 29 | } |
| 29 | return self; | 30 | return self; |
| 30 | } | 31 | } |
| 31 | -- (void)layoutSubviews | 32 | +- (void)makeSubViewsLayout |
| 32 | { | 33 | { |
| 33 | - [super layoutSubviews]; | ||
| 34 | [self.backImage mas_makeConstraints:^(MASConstraintMaker *make) { | 34 | [self.backImage mas_makeConstraints:^(MASConstraintMaker *make) { |
| 35 | make.top.bottom.equalTo(self.contentView); | 35 | make.top.bottom.equalTo(self.contentView); |
| 36 | make.left.equalTo(self.contentView).offset(10); | 36 | make.left.equalTo(self.contentView).offset(10); |
| @@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
| 59 | NSDictionary *dic = array[i]; | 59 | NSDictionary *dic = array[i]; |
| 60 | CnLivePageContentModel *model = [CnLivePageContentModel mj_objectWithKeyValues:dic]; | 60 | CnLivePageContentModel *model = [CnLivePageContentModel mj_objectWithKeyValues:dic]; |
| 61 | [sqArr addObject:model]; | 61 | [sqArr addObject:model]; |
| 62 | - if ((i != 0 || array.count == 1) && (i%2 == 0 || i == array.count - 1)) { | 62 | + if ((i != 0 || array.count == 1) && ((i + 1)%3 == 0 || i == array.count - 1)) { |
| 63 | NSDictionary *category = @{ | 63 | NSDictionary *category = @{ |
| 64 | @"title":@"大家都在用", | 64 | @"title":@"大家都在用", |
| 65 | @"lists":sqArr.copy, | 65 | @"lists":sqArr.copy, |
| @@ -87,7 +87,6 @@ | @@ -87,7 +87,6 @@ | ||
| 87 | [self.titleLabel sizeToFit]; | 87 | [self.titleLabel sizeToFit]; |
| 88 | self.subTitlelabel.text = model.blockSubTitle; | 88 | self.subTitlelabel.text = model.blockSubTitle; |
| 89 | [self.subTitlelabel sizeToFit]; | 89 | [self.subTitlelabel sizeToFit]; |
| 90 | - [self setNeedsLayout]; | ||
| 91 | } | 90 | } |
| 92 | - (UIImageView *)backImage | 91 | - (UIImageView *)backImage |
| 93 | { | 92 | { |
CNLiveCServiceModule/Classes/View/CNLiveServiceOrLookCell.m
| @@ -21,11 +21,11 @@ | @@ -21,11 +21,11 @@ | ||
| 21 | [self.contentView addSubview:self.titleLabel]; | 21 | [self.contentView addSubview:self.titleLabel]; |
| 22 | [self.contentView addSubview:self.describe]; | 22 | [self.contentView addSubview:self.describe]; |
| 23 | [self.contentView addSubview:self.rightBtn]; | 23 | [self.contentView addSubview:self.rightBtn]; |
| 24 | + [self makeSubViewsLayout]; | ||
| 24 | } | 25 | } |
| 25 | return self; | 26 | return self; |
| 26 | } | 27 | } |
| 27 | -- (void)layoutSubviews{ | ||
| 28 | - [super layoutSubviews]; | 28 | +- (void)makeSubViewsLayout{ |
| 29 | [self.logoImage mas_makeConstraints:^(MASConstraintMaker *make) { | 29 | [self.logoImage mas_makeConstraints:^(MASConstraintMaker *make) { |
| 30 | make.left.equalTo(self.contentView).offset(10); | 30 | make.left.equalTo(self.contentView).offset(10); |
| 31 | make.centerY.equalTo(self.contentView); | 31 | make.centerY.equalTo(self.contentView); |
| @@ -56,7 +56,6 @@ | @@ -56,7 +56,6 @@ | ||
| 56 | [self.titleLabel sizeToFit]; | 56 | [self.titleLabel sizeToFit]; |
| 57 | self.describe.text = model.subTitle; | 57 | self.describe.text = model.subTitle; |
| 58 | [self.describe sizeToFit]; | 58 | [self.describe sizeToFit]; |
| 59 | - [self setNeedsLayout]; | ||
| 60 | } | 59 | } |
| 61 | - (void)setType:(CNLiveCellShowType)type | 60 | - (void)setType:(CNLiveCellShowType)type |
| 62 | { | 61 | { |
CNLiveCServiceModule/Classes/View/CNLiveVideoRecommendCell.m
| @@ -25,15 +25,15 @@ | @@ -25,15 +25,15 @@ | ||
| 25 | [self.contentView addSubview:self.price]; | 25 | [self.contentView addSubview:self.price]; |
| 26 | [self.contentView addSubview:self.oldPrice]; | 26 | [self.contentView addSubview:self.oldPrice]; |
| 27 | [self.contentView addSubview:self.lookNum]; | 27 | [self.contentView addSubview:self.lookNum]; |
| 28 | + [self makeSubViewsLayout]; | ||
| 28 | } | 29 | } |
| 29 | return self; | 30 | return self; |
| 30 | } | 31 | } |
| 31 | -- (void)layoutSubviews{ | ||
| 32 | - [super layoutSubviews]; | 32 | +- (void)makeSubViewsLayout{ |
| 33 | [self.logoImage mas_makeConstraints:^(MASConstraintMaker *make) { | 33 | [self.logoImage mas_makeConstraints:^(MASConstraintMaker *make) { |
| 34 | make.top.equalTo(self.contentView); | 34 | make.top.equalTo(self.contentView); |
| 35 | make.centerX.equalTo(self.contentView); | 35 | make.centerX.equalTo(self.contentView); |
| 36 | - make.height.width.offset(_type == CNLiveCellShowTypeHot?65:96); | 36 | + make.height.width.offset(65); |
| 37 | }]; | 37 | }]; |
| 38 | 38 | ||
| 39 | [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | 39 | [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
| @@ -41,14 +41,8 @@ | @@ -41,14 +41,8 @@ | ||
| 41 | make.left.right.equalTo(self.logoImage); | 41 | make.left.right.equalTo(self.logoImage); |
| 42 | }]; | 42 | }]; |
| 43 | [self.price mas_makeConstraints:^(MASConstraintMaker *make) { | 43 | [self.price mas_makeConstraints:^(MASConstraintMaker *make) { |
| 44 | - make.top.equalTo(_type == CNLiveCellShowTypeHot?self.logoImage.mas_bottom:self.titleLabel.mas_bottom).offset(5); | ||
| 45 | - if (_type == CNLiveCellShowTypeHot) { | ||
| 46 | - make.centerX.equalTo(self.contentView); | ||
| 47 | - }else{ | 44 | + make.top.equalTo(self.titleLabel.mas_bottom).offset(5); |
| 48 | make.left.equalTo(self.logoImage); | 45 | make.left.equalTo(self.logoImage); |
| 49 | - } | ||
| 50 | - | ||
| 51 | - | ||
| 52 | }]; | 46 | }]; |
| 53 | [self.oldPrice mas_makeConstraints:^(MASConstraintMaker *make) { | 47 | [self.oldPrice mas_makeConstraints:^(MASConstraintMaker *make) { |
| 54 | make.left.equalTo(self.price.mas_right).offset(7); | 48 | make.left.equalTo(self.price.mas_right).offset(7); |
| @@ -75,6 +69,13 @@ | @@ -75,6 +69,13 @@ | ||
| 75 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:[model.desc dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error]; | 69 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:[model.desc dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error]; |
| 76 | self.price.text = [NSString stringWithFormat:@"¥%@",dic[@"price"]]; | 70 | self.price.text = [NSString stringWithFormat:@"¥%@",dic[@"price"]]; |
| 77 | [self.price sizeToFit]; | 71 | [self.price sizeToFit]; |
| 72 | + [self.logoImage mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 73 | + make.height.width.offset(65); | ||
| 74 | + }]; | ||
| 75 | + [self.price mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 76 | + make.top.equalTo(self.logoImage.mas_bottom).offset(5); | ||
| 77 | + make.centerX.equalTo(self); | ||
| 78 | + }]; | ||
| 78 | }else if (_type == CNLiveCellShowTypeVideo){ | 79 | }else if (_type == CNLiveCellShowTypeVideo){ |
| 79 | self.titleLabel.hidden = NO; | 80 | self.titleLabel.hidden = NO; |
| 80 | self.titleLabel.numberOfLines = 2; | 81 | self.titleLabel.numberOfLines = 2; |
| @@ -82,9 +83,12 @@ | @@ -82,9 +83,12 @@ | ||
| 82 | self.titleLabel.text = model.title; | 83 | self.titleLabel.text = model.title; |
| 83 | NSString *num = model.spectators; | 84 | NSString *num = model.spectators; |
| 84 | if (num.floatValue > 10000) { | 85 | if (num.floatValue > 10000) { |
| 85 | - num = [NSString stringWithFormat:@"%.1f",num.floatValue/10000]; | 86 | + num = [NSString stringWithFormat:@"%.1f万",num.floatValue/10000]; |
| 86 | } | 87 | } |
| 87 | [self.lookNum setTitle:[NSString stringWithFormat:@"%@浏览",num] forState:UIControlStateNormal]; | 88 | [self.lookNum setTitle:[NSString stringWithFormat:@"%@浏览",num] forState:UIControlStateNormal]; |
| 89 | + [self.logoImage mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 90 | + make.height.width.offset(96); | ||
| 91 | + }]; | ||
| 88 | }else{ | 92 | }else{ |
| 89 | self.titleLabel.hidden = NO; | 93 | self.titleLabel.hidden = NO; |
| 90 | self.price.hidden = NO; | 94 | self.price.hidden = NO; |
| @@ -107,9 +111,14 @@ | @@ -107,9 +111,14 @@ | ||
| 107 | self.oldPrice.attributedText = string; | 111 | self.oldPrice.attributedText = string; |
| 108 | [self.oldPrice sizeToFit]; | 112 | [self.oldPrice sizeToFit]; |
| 109 | } | 113 | } |
| 110 | - | 114 | + [self.logoImage mas_updateConstraints:^(MASConstraintMaker *make) { |
| 115 | + make.height.width.offset(96); | ||
| 116 | + }]; | ||
| 117 | + [self.price mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 118 | + make.top.equalTo(self.titleLabel.mas_bottom).offset(5); | ||
| 119 | + make.left.equalTo(self.logoImage); | ||
| 120 | + }]; | ||
| 111 | } | 121 | } |
| 112 | - [self setNeedsLayout]; | ||
| 113 | } | 122 | } |
| 114 | - (UIImageView *)logoImage{ | 123 | - (UIImageView *)logoImage{ |
| 115 | if (!_logoImage) { | 124 | if (!_logoImage) { |
CNLiveCServiceModule/Classes/ViewController/CNLiveAllServiceVC.m
| @@ -174,6 +174,9 @@ static NSString *HistoryFootID = @"UICollectionFooterView"; | @@ -174,6 +174,9 @@ static NSString *HistoryFootID = @"UICollectionFooterView"; | ||
| 174 | #pragma mark - UICollectionViewDelegateFlowLayout | 174 | #pragma mark - UICollectionViewDelegateFlowLayout |
| 175 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ | 175 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ |
| 176 | CNLiveSearchHotsModel *model = self.dataSource[indexPath.section]; | 176 | CNLiveSearchHotsModel *model = self.dataSource[indexPath.section]; |
| 177 | + if (_serviceId &&![_serviceId isEqualToString:@""]&&indexPath.section != 0){ | ||
| 178 | + return CGSizeMake(collectionView.width, model.layout.height); | ||
| 179 | + } | ||
| 177 | return CGSizeMake(model.layout.width, model.layout.height); | 180 | return CGSizeMake(model.layout.width, model.layout.height); |
| 178 | } | 181 | } |
| 179 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ | 182 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ |
CNLiveCServiceModule/Classes/ViewController/CNLiveMyServicesVC.m
| @@ -169,14 +169,20 @@ static NSString *HotListCellID = @"HotListCellID"; | @@ -169,14 +169,20 @@ static NSString *HotListCellID = @"HotListCellID"; | ||
| 169 | strongself | 169 | strongself |
| 170 | [self.navigationController popViewControllerAnimated:YES]; | 170 | [self.navigationController popViewControllerAnimated:YES]; |
| 171 | }; | 171 | }; |
| 172 | -// [_navigationBar.right setTitleColor:CNLiveColorWithHexString(@"#F5A623") forState:UIControlStateNormal]; | 172 | + [_navigationBar.right setTitleColor:CNLiveColorWithHexString(@"#F5A623") forState:UIControlStateNormal]; |
| 173 | _navigationBar.rightTitle = @"清空"; | 173 | _navigationBar.rightTitle = @"清空"; |
| 174 | _navigationBar.onClickRightButton = ^{ | 174 | _navigationBar.onClickRightButton = ^{ |
| 175 | - | ||
| 176 | - [CNLiveServicePresent removeMyServiceResult:^{ | ||
| 177 | - strongself | ||
| 178 | - [self myServiceData]; | 175 | + UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"确认清空所有服务吗?" message:nil preferredStyle:UIAlertControllerStyleAlert]; |
| 176 | + UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:NULL]; | ||
| 177 | + UIAlertAction *sure = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 178 | + [CNLiveServicePresent removeMyServiceResult:^{ | ||
| 179 | + strongself | ||
| 180 | + [self myServiceData]; | ||
| 181 | + }]; | ||
| 179 | }]; | 182 | }]; |
| 183 | + [alertVC addAction:cancel]; | ||
| 184 | + [alertVC addAction:sure]; | ||
| 185 | + [weakSelf presentViewController:alertVC animated:YES completion:NULL]; | ||
| 180 | }; | 186 | }; |
| 181 | 187 | ||
| 182 | } | 188 | } |
CNLiveCServiceModule/Classes/ViewController/CNLiveServiceSearchVC.m
| @@ -50,13 +50,7 @@ static NSString *HistoryFootID = @"HistoryFootID"; | @@ -50,13 +50,7 @@ static NSString *HistoryFootID = @"HistoryFootID"; | ||
| 50 | [self.listTableView reloadData]; | 50 | [self.listTableView reloadData]; |
| 51 | } | 51 | } |
| 52 | if (![CNLiveNetworking isNetworking]) { | 52 | if (![CNLiveNetworking isNetworking]) { |
| 53 | - if (self.dataListArr.count > 0) { | ||
| 54 | - return; | ||
| 55 | - } | ||
| 56 | - self.listCollectionView.mj_footer.hidden = YES; | ||
| 57 | - [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(searchRequese)]; | ||
| 58 | - self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); | ||
| 59 | - [self setCNAPIErrorEmptyView]; | 53 | + [QMUITips showError:@"网络未连接" inView:self.view hideAfterDelay:2]; |
| 60 | return; | 54 | return; |
| 61 | } | 55 | } |
| 62 | [QMUITips showLoadingInView:self.view]; | 56 | [QMUITips showLoadingInView:self.view]; |
| @@ -90,11 +84,7 @@ static NSString *HistoryFootID = @"HistoryFootID"; | @@ -90,11 +84,7 @@ static NSString *HistoryFootID = @"HistoryFootID"; | ||
| 90 | [self.listTableView reloadData]; | 84 | [self.listTableView reloadData]; |
| 91 | } | 85 | } |
| 92 | } error:^{ | 86 | } error:^{ |
| 93 | - weakSelf.listCollectionView.hidden = YES; | ||
| 94 | - strongself | ||
| 95 | - [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(searchRequese)]; | ||
| 96 | - self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); | ||
| 97 | - [self setCNAPIErrorEmptyView]; | 87 | + [QMUITips hideAllTipsInView:self.view]; |
| 98 | 88 | ||
| 99 | }]; | 89 | }]; |
| 100 | } | 90 | } |
| @@ -160,11 +150,17 @@ static NSString *HistoryFootID = @"HistoryFootID"; | @@ -160,11 +150,17 @@ static NSString *HistoryFootID = @"HistoryFootID"; | ||
| 160 | { | 150 | { |
| 161 | [super viewWillAppear:animated]; | 151 | [super viewWillAppear:animated]; |
| 162 | self.navigationController.navigationBarHidden = YES; | 152 | self.navigationController.navigationBarHidden = YES; |
| 153 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resignActive) name:UIApplicationDidEnterBackgroundNotification object:nil]; | ||
| 163 | } | 154 | } |
| 164 | - (void)viewWillDisappear:(BOOL)animated | 155 | - (void)viewWillDisappear:(BOOL)animated |
| 165 | { | 156 | { |
| 166 | [super viewWillDisappear:animated]; | 157 | [super viewWillDisappear:animated]; |
| 167 | self.navigationController.navigationBarHidden = NO; | 158 | self.navigationController.navigationBarHidden = NO; |
| 159 | + [[NSNotificationCenter defaultCenter] removeObserver:self]; | ||
| 160 | + [CNLiveServiceHistorySearch saveHistorySearch:self.histories.mutableCopy]; | ||
| 161 | +} | ||
| 162 | +#pragma mark - Notification | ||
| 163 | +- (void)resignActive{ | ||
| 168 | [CNLiveServiceHistorySearch saveHistorySearch:self.histories.mutableCopy]; | 164 | [CNLiveServiceHistorySearch saveHistorySearch:self.histories.mutableCopy]; |
| 169 | } | 165 | } |
| 170 | #pragma mark - Action | 166 | #pragma mark - Action |
| @@ -208,6 +204,14 @@ static NSString *HistoryFootID = @"HistoryFootID"; | @@ -208,6 +204,14 @@ static NSString *HistoryFootID = @"HistoryFootID"; | ||
| 208 | { | 204 | { |
| 209 | CNLiveHistoryModel *model1 = model.lists[indexPath.row]; | 205 | CNLiveHistoryModel *model1 = model.lists[indexPath.row]; |
| 210 | self.searchStr = model1.title; | 206 | self.searchStr = model1.title; |
| 207 | + NSMutableArray *array = [[NSMutableArray alloc] initWithArray:self.histories]; | ||
| 208 | + [array removeObjectAtIndex:indexPath.row]; | ||
| 209 | + NSDictionary *dic = @{ | ||
| 210 | + @"title":_searchStr, | ||
| 211 | + }; | ||
| 212 | + [array insertObject:dic atIndex:0]; | ||
| 213 | + self.histories = array.copy; | ||
| 214 | + [self dealHotsAndHistories]; | ||
| 211 | self.searchView.searchField.text = self.searchStr; | 215 | self.searchView.searchField.text = self.searchStr; |
| 212 | [self searchRequese]; | 216 | [self searchRequese]; |
| 213 | } | 217 | } |
| @@ -263,7 +267,8 @@ static NSString *HistoryFootID = @"HistoryFootID"; | @@ -263,7 +267,8 @@ static NSString *HistoryFootID = @"HistoryFootID"; | ||
| 263 | return CGSizeMake(collectionView.width, 40); | 267 | return CGSizeMake(collectionView.width, 40); |
| 264 | } | 268 | } |
| 265 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section{ | 269 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section{ |
| 266 | - if (section == 0) { | 270 | + CNLiveSearchHotsModel *model = self.hDataSources[section]; |
| 271 | + if ([model.title isEqualToString:@"热度推荐"]) { | ||
| 267 | return CGSizeMake(0, 0); | 272 | return CGSizeMake(0, 0); |
| 268 | } | 273 | } |
| 269 | return CGSizeMake(self.view.width, 40); | 274 | return CGSizeMake(self.view.width, 40); |
CNLiveCServiceModule/Classes/ViewController/CNLiveServiceVC.m
| @@ -41,6 +41,9 @@ static NSString *CNGoodsOrVideoheaderID = @"CNLiveGoodsOrVideoHeaderView"; | @@ -41,6 +41,9 @@ static NSString *CNGoodsOrVideoheaderID = @"CNLiveGoodsOrVideoHeaderView"; | ||
| 41 | @implementation CNLiveServiceVC | 41 | @implementation CNLiveServiceVC |
| 42 | - (void)requestService{ | 42 | - (void)requestService{ |
| 43 | if (![CNLiveNetworking isNetworking]) { | 43 | if (![CNLiveNetworking isNetworking]) { |
| 44 | + if (self.dataSource.count>0 && self.pageListSource.count>0) { | ||
| 45 | + return; | ||
| 46 | + } | ||
| 44 | [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(requestService)]; | 47 | [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(requestService)]; |
| 45 | self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); | 48 | self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); |
| 46 | [self setCNAPIErrorEmptyView]; | 49 | [self setCNAPIErrorEmptyView]; |
| @@ -56,7 +59,11 @@ static NSString *CNGoodsOrVideoheaderID = @"CNLiveGoodsOrVideoHeaderView"; | @@ -56,7 +59,11 @@ static NSString *CNGoodsOrVideoheaderID = @"CNLiveGoodsOrVideoHeaderView"; | ||
| 56 | self.hots = hots; | 59 | self.hots = hots; |
| 57 | dispatch_group_leave(requestGroup); | 60 | dispatch_group_leave(requestGroup); |
| 58 | } error:^{ | 61 | } error:^{ |
| 62 | + | ||
| 59 | strongself | 63 | strongself |
| 64 | + if (self.dataSource.count>0 && self.pageListSource.count>0) { | ||
| 65 | + return; | ||
| 66 | + } | ||
| 60 | [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(requestService)]; | 67 | [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(requestService)]; |
| 61 | self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); | 68 | self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); |
| 62 | [self setCNAPIErrorEmptyView]; | 69 | [self setCNAPIErrorEmptyView]; |
| @@ -69,6 +76,9 @@ static NSString *CNGoodsOrVideoheaderID = @"CNLiveGoodsOrVideoHeaderView"; | @@ -69,6 +76,9 @@ static NSString *CNGoodsOrVideoheaderID = @"CNLiveGoodsOrVideoHeaderView"; | ||
| 69 | } error:^{ | 76 | } error:^{ |
| 70 | 77 | ||
| 71 | strongself | 78 | strongself |
| 79 | + if (self.dataSource.count>0 && self.pageListSource.count>0) { | ||
| 80 | + return; | ||
| 81 | + } | ||
| 72 | [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(requestService)]; | 82 | [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(requestService)]; |
| 73 | self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); | 83 | self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); |
| 74 | [self setCNAPIErrorEmptyView]; | 84 | [self setCNAPIErrorEmptyView]; |