Commit 5b87c60a05e00c6eb2f3ef99dde19a267097c5b3
1 parent
2e03faa8
no message
Showing
5 changed files
with
55 additions
and
47 deletions
CNLiveMineModule/Classes/Controller/CNLiveMineController.m
| @@ -154,6 +154,7 @@ static const CGFloat timeValue = 1.5; | @@ -154,6 +154,7 @@ static const CGFloat timeValue = 1.5; | ||
| 154 | if(self.soccerBtn){ | 154 | if(self.soccerBtn){ |
| 155 | self.soccerBtn.frame = CGRectMake(SCREEN_WIDTH-67-10, SCREEN_HEIGHT-71-10-TabBarHeight, 67, 71); | 155 | self.soccerBtn.frame = CGRectMake(SCREEN_WIDTH-67-10, SCREEN_HEIGHT-71-10-TabBarHeight, 67, 71); |
| 156 | } | 156 | } |
| 157 | + self.headerView.isRefresh = YES; | ||
| 157 | [self.tableView reloadData]; | 158 | [self.tableView reloadData]; |
| 158 | } | 159 | } |
| 159 | 160 |
CNLiveMineModule/Classes/Model/CNLiveMineModel.m
| @@ -48,7 +48,7 @@ static const NSInteger margin = 10; | @@ -48,7 +48,7 @@ static const NSInteger margin = 10; | ||
| 48 | - (CGFloat)height{ | 48 | - (CGFloat)height{ |
| 49 | //订单 | 49 | //订单 |
| 50 | if(self.type == CNLiveMineCellTypeOrder){ | 50 | if(self.type == CNLiveMineCellTypeOrder){ |
| 51 | - return 2*margin+self.titleHeight+self.itemHeight+margin; | 51 | + return 2*margin+self.titleHeight+ceilf(self.buttons.count/5.0)*(self.itemHeight+margin); |
| 52 | } | 52 | } |
| 53 | //工具 | 53 | //工具 |
| 54 | else if(self.type == CNLiveMineCellTypeTool){ | 54 | else if(self.type == CNLiveMineCellTypeTool){ |
CNLiveMineModule/Classes/View/CNLiveMineCell.m
| @@ -42,7 +42,6 @@ | @@ -42,7 +42,6 @@ | ||
| 42 | [self.contentView addSubview:self.allButton]; | 42 | [self.contentView addSubview:self.allButton]; |
| 43 | [self.contentView addSubview:self.line]; | 43 | [self.contentView addSubview:self.line]; |
| 44 | [self.contentView addSubview:self.collectionView]; | 44 | [self.contentView addSubview:self.collectionView]; |
| 45 | - | ||
| 46 | } | 45 | } |
| 47 | 46 | ||
| 48 | - (void)setModel:(CNLiveMineModel *)model{ | 47 | - (void)setModel:(CNLiveMineModel *)model{ |
| @@ -262,7 +261,7 @@ | @@ -262,7 +261,7 @@ | ||
| 262 | return _collectionView; | 261 | return _collectionView; |
| 263 | } | 262 | } |
| 264 | 263 | ||
| 265 | -#pragma mark - 代理 | 264 | +#pragma mark - UICollectionViewDelegate, UICollectionViewDataSource |
| 266 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { | 265 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { |
| 267 | switch (self.model.type) { | 266 | switch (self.model.type) { |
| 268 | case CNLiveMineCellTypeOrder: | 267 | case CNLiveMineCellTypeOrder: |
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.h
| @@ -26,7 +26,7 @@ typedef NS_ENUM(NSInteger, CNLiveMineHeaderViewType) { | @@ -26,7 +26,7 @@ typedef NS_ENUM(NSInteger, CNLiveMineHeaderViewType) { | ||
| 26 | @interface CNLiveMineHeaderView : UIView | 26 | @interface CNLiveMineHeaderView : UIView |
| 27 | @property (nonatomic, weak) id<CNLiveMineHeaderViewDelegate> delegate; | 27 | @property (nonatomic, weak) id<CNLiveMineHeaderViewDelegate> delegate; |
| 28 | @property (nonatomic, assign) BOOL interactionEnabled; | 28 | @property (nonatomic, assign) BOOL interactionEnabled; |
| 29 | - | 29 | +@property (nonatomic, assign) BOOL isRefresh; |
| 30 | - (void)layoutSubviews; | 30 | - (void)layoutSubviews; |
| 31 | 31 | ||
| 32 | @end | 32 | @end |
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.m
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | #import <SDWebImage/SDWebImage.h> | 11 | #import <SDWebImage/SDWebImage.h> |
| 12 | #import "QMUIKit.h" | 12 | #import "QMUIKit.h" |
| 13 | #import "CNLiveCategory.h" | 13 | #import "CNLiveCategory.h" |
| 14 | +#import "CNLiveBaseKit.h" | ||
| 14 | 15 | ||
| 15 | #import "CNUserInfoManager.h" | 16 | #import "CNUserInfoManager.h" |
| 16 | #import "CNLiveUserInfoNotification.h" | 17 | #import "CNLiveUserInfoNotification.h" |
| @@ -51,10 +52,10 @@ static const NSInteger margin = 20; | @@ -51,10 +52,10 @@ static const NSInteger margin = 20; | ||
| 51 | [_header sd_setImageWithURL:[NSURL URLWithString:info] placeholderImage:xw_image]; | 52 | [_header sd_setImageWithURL:[NSURL URLWithString:info] placeholderImage:xw_image]; |
| 52 | 53 | ||
| 53 | }else if(type == CNLiveUserInfoDataTypeNickname){ | 54 | }else if(type == CNLiveUserInfoDataTypeNickname){ |
| 54 | - _name.attributedText = [self createAttributedImageName:@"mine_code" string:info isFront:NO]; | 55 | + _name.attributedText = [self createAttributedImageName:@"mine_code" string:info font:16.0 isFront:NO]; |
| 55 | 56 | ||
| 56 | }else if(type == CNLiveUserInfoDataTypeAddress){ | 57 | }else if(type == CNLiveUserInfoDataTypeAddress){ |
| 57 | - _address.attributedText = [self createAttributedImageName:@"mine_location" string:info isFront:YES]; | 58 | + _address.attributedText = [self createAttributedImageName:@"mine_location" string:info font:13.0 isFront:YES]; |
| 58 | 59 | ||
| 59 | } | 60 | } |
| 60 | } | 61 | } |
| @@ -62,7 +63,6 @@ static const NSInteger margin = 20; | @@ -62,7 +63,6 @@ static const NSInteger margin = 20; | ||
| 62 | - (void)dealloc { | 63 | - (void)dealloc { |
| 63 | NSLog(@"CNLiveMineHeaderView -- dealloc"); | 64 | NSLog(@"CNLiveMineHeaderView -- dealloc"); |
| 64 | [CNLiveUserInfoNotification removeObserver:self]; | 65 | [CNLiveUserInfoNotification removeObserver:self]; |
| 65 | - | ||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | - (void)createSubViews { | 68 | - (void)createSubViews { |
| @@ -112,7 +112,6 @@ static const NSInteger margin = 20; | @@ -112,7 +112,6 @@ static const NSInteger margin = 20; | ||
| 112 | [_name mas_remakeConstraints:^(MASConstraintMaker *make) { | 112 | [_name mas_remakeConstraints:^(MASConstraintMaker *make) { |
| 113 | make.bottom.equalTo(self.certification.mas_top); | 113 | make.bottom.equalTo(self.certification.mas_top); |
| 114 | make.left.equalTo(self.certification.mas_left); | 114 | make.left.equalTo(self.certification.mas_left); |
| 115 | -// make.right.equalTo(self.bgView.mas_right).with.offset(-margin); | ||
| 116 | make.right.mas_lessThanOrEqualTo(self.bgView.mas_right).with.offset(-margin); | 115 | make.right.mas_lessThanOrEqualTo(self.bgView.mas_right).with.offset(-margin); |
| 117 | make.height.equalTo(self.certification.mas_height); | 116 | make.height.equalTo(self.certification.mas_height); |
| 118 | 117 | ||
| @@ -134,6 +133,21 @@ static const NSInteger margin = 20; | @@ -134,6 +133,21 @@ static const NSInteger margin = 20; | ||
| 134 | 133 | ||
| 135 | }]; | 134 | }]; |
| 136 | } | 135 | } |
| 136 | + | ||
| 137 | +- (void)setInteractionEnabled:(BOOL)interactionEnabled{ | ||
| 138 | + _interactionEnabled = interactionEnabled; | ||
| 139 | + _sign.userInteractionEnabled = interactionEnabled; | ||
| 140 | + _witness.userInteractionEnabled = interactionEnabled; | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +- (void)setIsRefresh:(BOOL)isRefresh{ | ||
| 144 | + _isRefresh = isRefresh; | ||
| 145 | + if(isRefresh){ | ||
| 146 | + _name.attributedText = [self createAttributedImageName:@"mine_code" string:CNUserShareModel.nickname font:16.0 isFront:NO]; | ||
| 147 | + _address.attributedText = [self createAttributedImageName:@"mine_location" string:CNUserShareModel.location font:13.0 isFront:YES]; | ||
| 148 | + } | ||
| 149 | +} | ||
| 150 | + | ||
| 137 | /* | 151 | /* |
| 138 | // Only override drawRect: if you perform custom drawing. | 152 | // Only override drawRect: if you perform custom drawing. |
| 139 | // An empty implementation adversely affects performance during animation. | 153 | // An empty implementation adversely affects performance during animation. |
| @@ -142,7 +156,7 @@ static const NSInteger margin = 20; | @@ -142,7 +156,7 @@ static const NSInteger margin = 20; | ||
| 142 | } | 156 | } |
| 143 | */ | 157 | */ |
| 144 | #pragma mark - Private Methods | 158 | #pragma mark - Private Methods |
| 145 | -- (NSMutableAttributedString *)createAttributedImageName:(NSString *)imageName string:(NSString *)string isFront:(BOOL)isFront{ | 159 | +- (NSMutableAttributedString *)createAttributedImageName:(NSString *)imageName string:(NSString *)string font:(CGFloat)font isFront:(BOOL)isFront{ |
| 146 | if(isFront){ | 160 | if(isFront){ |
| 147 | string = [NSString stringWithFormat:@" %@",string]; | 161 | string = [NSString stringWithFormat:@" %@",string]; |
| 148 | } | 162 | } |
| @@ -150,15 +164,15 @@ static const NSInteger margin = 20; | @@ -150,15 +164,15 @@ static const NSInteger margin = 20; | ||
| 150 | NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:string]; | 164 | NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:string]; |
| 151 | // 修改富文本中的不同文字的样式 | 165 | // 修改富文本中的不同文字的样式 |
| 152 | // [attri addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, string.length)]; | 166 | // [attri addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, string.length)]; |
| 153 | -// [attri addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, string.length)]; | 167 | + [attri addAttribute:NSFontAttributeName value:UIFontCNMake(font) range:NSMakeRange(0, string.length)]; |
| 154 | // 2.添加表情图片 | 168 | // 2.添加表情图片 |
| 155 | NSTextAttachment *attch = [[NSTextAttachment alloc] init]; | 169 | NSTextAttachment *attch = [[NSTextAttachment alloc] init]; |
| 156 | // 表情图片 | 170 | // 表情图片 |
| 157 | - UIImage *xw_image = [self getImageWithImageName:imageName bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; | 171 | + UIImage *xw_image = [self getImageWithImageName:imageName bundleName:@"CNLiveMineModule" targetClass:[self class]]; |
| 158 | attch.image = xw_image; | 172 | attch.image = xw_image; |
| 159 | if(isFront){ | 173 | if(isFront){ |
| 160 | // 设置图片大小 | 174 | // 设置图片大小 |
| 161 | - attch.bounds = CGRectMake(0, -1.5, 10, 12); | 175 | + attch.bounds = CGRectMake(0, -2, 10, 12); |
| 162 | // 创建带有图片的富文本 | 176 | // 创建带有图片的富文本 |
| 163 | NSAttributedString *str = [NSAttributedString attributedStringWithAttachment:attch]; | 177 | NSAttributedString *str = [NSAttributedString attributedStringWithAttachment:attch]; |
| 164 | [attri insertAttributedString:str atIndex:0];// 插入某个位置 | 178 | [attri insertAttributedString:str atIndex:0];// 插入某个位置 |
| @@ -194,6 +208,33 @@ static const NSInteger margin = 20; | @@ -194,6 +208,33 @@ static const NSInteger margin = 20; | ||
| 194 | 208 | ||
| 195 | } | 209 | } |
| 196 | 210 | ||
| 211 | +#pragma mark - 响应方法 | ||
| 212 | +- (void)headerTapDidClicked:(UITapGestureRecognizer *)tap{ | ||
| 213 | + if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) { | ||
| 214 | + [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeUerInfo]; | ||
| 215 | + } | ||
| 216 | +} | ||
| 217 | + | ||
| 218 | +- (void)nameTapDidClicked:(UITapGestureRecognizer *)tap{ | ||
| 219 | + if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) { | ||
| 220 | + [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeCode]; | ||
| 221 | + } | ||
| 222 | +} | ||
| 223 | + | ||
| 224 | +- (void)signDidClicked:(UIButton *)btn{ | ||
| 225 | + if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) { | ||
| 226 | + btn.userInteractionEnabled = NO; | ||
| 227 | + [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeSign]; | ||
| 228 | + } | ||
| 229 | +} | ||
| 230 | + | ||
| 231 | +- (void)witnessDidClicked:(UIButton *)btn{ | ||
| 232 | + if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) { | ||
| 233 | + btn.userInteractionEnabled = NO; | ||
| 234 | + [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeWintess]; | ||
| 235 | + } | ||
| 236 | +} | ||
| 237 | + | ||
| 197 | #pragma mark - 懒加载 | 238 | #pragma mark - 懒加载 |
| 198 | - (UIButton *)witness { | 239 | - (UIButton *)witness { |
| 199 | if (!_witness) { | 240 | if (!_witness) { |
| @@ -236,7 +277,7 @@ static const NSInteger margin = 20; | @@ -236,7 +277,7 @@ static const NSInteger margin = 20; | ||
| 236 | _name.numberOfLines = 1; | 277 | _name.numberOfLines = 1; |
| 237 | _name.textColor = [UIColor whiteColor]; | 278 | _name.textColor = [UIColor whiteColor]; |
| 238 | _name.font = [UIFont systemFontOfSize:16]; | 279 | _name.font = [UIFont systemFontOfSize:16]; |
| 239 | - _name.attributedText = [self createAttributedImageName:@"mine_code" string:CNUserShareModel.nickname isFront:NO]; | 280 | + _name.attributedText = [self createAttributedImageName:@"mine_code" string:CNUserShareModel.nickname font:16.0 isFront:NO]; |
| 240 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(nameTapDidClicked:)]; | 281 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(nameTapDidClicked:)]; |
| 241 | [_name addGestureRecognizer:tap]; | 282 | [_name addGestureRecognizer:tap]; |
| 242 | 283 | ||
| @@ -259,7 +300,7 @@ static const NSInteger margin = 20; | @@ -259,7 +300,7 @@ static const NSInteger margin = 20; | ||
| 259 | _address.numberOfLines = 1; | 300 | _address.numberOfLines = 1; |
| 260 | _address.textColor = [UIColor colorWithRed:140/255.0 green:140/255.0 blue:142/255.0 alpha:1.0]; | 301 | _address.textColor = [UIColor colorWithRed:140/255.0 green:140/255.0 blue:142/255.0 alpha:1.0]; |
| 261 | _address.font = [UIFont systemFontOfSize:13]; | 302 | _address.font = [UIFont systemFontOfSize:13]; |
| 262 | - _address.attributedText = [self createAttributedImageName:@"mine_location" string:CNUserShareModel.location isFront:YES]; | 303 | + _address.attributedText = [self createAttributedImageName:@"mine_location" string:CNUserShareModel.location font:13.0 isFront:YES]; |
| 263 | } | 304 | } |
| 264 | return _address; | 305 | return _address; |
| 265 | } | 306 | } |
| @@ -283,37 +324,4 @@ static const NSInteger margin = 20; | @@ -283,37 +324,4 @@ static const NSInteger margin = 20; | ||
| 283 | return _sign; | 324 | return _sign; |
| 284 | } | 325 | } |
| 285 | 326 | ||
| 286 | -#pragma mark - 响应方法 | ||
| 287 | -- (void)headerTapDidClicked:(UITapGestureRecognizer *)tap{ | ||
| 288 | - if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) { | ||
| 289 | - [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeUerInfo]; | ||
| 290 | - } | ||
| 291 | -} | ||
| 292 | - | ||
| 293 | -- (void)nameTapDidClicked:(UITapGestureRecognizer *)tap{ | ||
| 294 | - if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) { | ||
| 295 | - [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeCode]; | ||
| 296 | - } | ||
| 297 | -} | ||
| 298 | - | ||
| 299 | -- (void)setInteractionEnabled:(BOOL)interactionEnabled{ | ||
| 300 | - _interactionEnabled = interactionEnabled; | ||
| 301 | - _sign.userInteractionEnabled = interactionEnabled; | ||
| 302 | - _witness.userInteractionEnabled = interactionEnabled; | ||
| 303 | -} | ||
| 304 | - | ||
| 305 | -- (void)signDidClicked:(UIButton *)btn{ | ||
| 306 | - if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) { | ||
| 307 | - btn.userInteractionEnabled = NO; | ||
| 308 | - [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeSign]; | ||
| 309 | - } | ||
| 310 | -} | ||
| 311 | - | ||
| 312 | -- (void)witnessDidClicked:(UIButton *)btn{ | ||
| 313 | - if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) { | ||
| 314 | - btn.userInteractionEnabled = NO; | ||
| 315 | - [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeWintess]; | ||
| 316 | - } | ||
| 317 | -} | ||
| 318 | - | ||
| 319 | @end | 327 | @end |