Commit 1f98dc4476357ba28e70b8301bfd1420c877ffcc
1 parent
4ba95583
no message
Showing
7 changed files
with
36 additions
and
17 deletions
CNLiveMineModule/Classes/Controller/CNLiveMineController.m
| ... | ... | @@ -57,8 +57,8 @@ static const CGFloat timeValue = 1.5; |
| 57 | 57 | @"name":@"常用工具", |
| 58 | 58 | @"style":@"2", |
| 59 | 59 | @"margin":@"10", |
| 60 | - @"titles": @[@"收货地址", @"补贴余额", @"我的收藏",@"发布记录",@"邀请好友",@"设置",@"路径工具",@"小家音响"], | |
| 61 | - @"images":@[@"mine_address",@"mine_card",@"mine_like",@"mine_release",@"mine_invitation",@"mine_set",@"mine_tool_map",@"mine_home_box"] | |
| 60 | + @"titles": @[@"收货地址", @"补贴余额", @"我的收藏",@"发布记录",@"邀请好友",@"设置",@"路径工具",@"小家音响",@"我的礼物"], | |
| 61 | + @"images":@[@"mine_address",@"mine_card",@"mine_like",@"mine_release",@"mine_invitation",@"mine_set",@"mine_tool_map",@"mine_home_box",@"mine_home_box"] | |
| 62 | 62 | }, |
| 63 | 63 | @{ |
| 64 | 64 | @"name":@"购买的商品", | ... | ... |
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateController.m
| ... | ... | @@ -276,7 +276,7 @@ static const CGFloat timeValue = 1.5; |
| 276 | 276 | [self.textView resignFirstResponder]; |
| 277 | 277 | |
| 278 | 278 | switch (self.model.dataType) { |
| 279 | - case CNLiveUserInfoDataTypeHead://头像 | |
| 279 | + case CNLiveUserInfoDataTypeHeader://头像 | |
| 280 | 280 | { |
| 281 | 281 | [self updateHeaderActionSheetView]; |
| 282 | 282 | } |
| ... | ... | @@ -619,7 +619,7 @@ static const CGFloat timeValue = 1.5; |
| 619 | 619 | _navigationBar.backgroundColor = [UIColor whiteColor]; |
| 620 | 620 | _navigationBar.delegate = self; |
| 621 | 621 | switch (self.model.dataType) { |
| 622 | - case CNLiveUserInfoDataTypeHead: | |
| 622 | + case CNLiveUserInfoDataTypeHeader: | |
| 623 | 623 | { |
| 624 | 624 | UIImage *xw_image = [self getImageWithImageName:@"mine_info_set" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; |
| 625 | 625 | [_navigationBar.right setImage:xw_image forState:UIControlStateNormal]; |
| ... | ... | @@ -650,7 +650,7 @@ static const CGFloat timeValue = 1.5; |
| 650 | 650 | _contentView = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 50)]; |
| 651 | 651 | _contentView.backgroundColor = [UIColor whiteColor]; |
| 652 | 652 | switch (self.model.dataType) { |
| 653 | - case CNLiveUserInfoDataTypeHead: | |
| 653 | + case CNLiveUserInfoDataTypeHeader: | |
| 654 | 654 | { |
| 655 | 655 | self.view.backgroundColor = [UIColor blackColor]; |
| 656 | 656 | _contentView.backgroundColor = [UIColor blackColor]; | ... | ... |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoCell.m
| ... | ... | @@ -41,7 +41,7 @@ static const NSInteger margin = 12; |
| 41 | 41 | |
| 42 | 42 | - (void)setImage:(UIImage *)image{ |
| 43 | 43 | _image = image; |
| 44 | - if(self.model.dataType == CNLiveUserInfoDataTypeHead){ | |
| 44 | + if(self.model.dataType == CNLiveUserInfoDataTypeHeader){ | |
| 45 | 45 | _pic.image = image; |
| 46 | 46 | } |
| 47 | 47 | } |
| ... | ... | @@ -52,7 +52,7 @@ static const NSInteger margin = 12; |
| 52 | 52 | |
| 53 | 53 | _content.text = model.info; |
| 54 | 54 | |
| 55 | - if(model.dataType == CNLiveUserInfoDataTypeHead){ | |
| 55 | + if(model.dataType == CNLiveUserInfoDataTypeHeader){ | |
| 56 | 56 | _pic.backgroundColor = [UIColor whiteColor]; |
| 57 | 57 | _pic.contentMode = UIViewContentModeScaleToFill; |
| 58 | 58 | _pic.layer.masksToBounds = YES; | ... | ... |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoModel.h
| ... | ... | @@ -18,7 +18,7 @@ typedef NS_ENUM(NSInteger, CNLiveUserInfoLayoutType) { |
| 18 | 18 | |
| 19 | 19 | typedef NS_ENUM(NSInteger, CNLiveUserInfoDataType) { |
| 20 | 20 | CNLiveUserInfoDataTypeNickname = 0, |
| 21 | - CNLiveUserInfoDataTypeHead = 1, | |
| 21 | + CNLiveUserInfoDataTypeHeader = 1, | |
| 22 | 22 | CNLiveUserInfoDataTypeGender = 2, |
| 23 | 23 | CNLiveUserInfoDataTypeCode = 3, |
| 24 | 24 | CNLiveUserInfoDataTypeAddress = 4, | ... | ... |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoModel.m
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | |
| 27 | 27 | - (CNLiveUserInfoDataType)dataType{ |
| 28 | 28 | if([self.data isEqualToString:@"0"]){ |
| 29 | - return CNLiveUserInfoDataTypeHead; | |
| 29 | + return CNLiveUserInfoDataTypeHeader; | |
| 30 | 30 | } |
| 31 | 31 | else if([self.data isEqualToString:@"1"]){ |
| 32 | 32 | return CNLiveUserInfoDataTypeNickname; | ... | ... |
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.m
| ... | ... | @@ -46,7 +46,7 @@ static const NSInteger margin = 20; |
| 46 | 46 | NSDictionary *dic = [noti userInfo]; |
| 47 | 47 | CNLiveUserInfoDataType type = [[dic objectForKey:@"dataType"] integerValue]; |
| 48 | 48 | NSString *info = [dic objectForKey:@"info"]; |
| 49 | - if(type == CNLiveUserInfoDataTypeHead){ | |
| 49 | + if(type == CNLiveUserInfoDataTypeHeader){ | |
| 50 | 50 | UIImage *xw_image = [self getImageWithImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; |
| 51 | 51 | [_header sd_setImageWithURL:[NSURL URLWithString:info] placeholderImage:xw_image]; |
| 52 | 52 | |
| ... | ... | @@ -236,7 +236,7 @@ static const NSInteger margin = 20; |
| 236 | 236 | _name.numberOfLines = 1; |
| 237 | 237 | _name.textColor = [UIColor whiteColor]; |
| 238 | 238 | _name.font = [UIFont systemFontOfSize:16]; |
| 239 | - _name.attributedText = [self createAttributedImageName:@"mine_code" string:@"张晓文" isFront:NO]; | |
| 239 | + _name.attributedText = [self createAttributedImageName:@"mine_code" string:CNUserShareModel.nickname isFront:NO]; | |
| 240 | 240 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(nameTapDidClicked:)]; |
| 241 | 241 | [_name addGestureRecognizer:tap]; |
| 242 | 242 | ... | ... |
CNLiveMineModule/Classes/View/CNLiveMineNavigationBar.m
| ... | ... | @@ -13,6 +13,8 @@ |
| 13 | 13 | #import "CNUserInfoManager.h" |
| 14 | 14 | #import "CNLiveCategory.h" |
| 15 | 15 | |
| 16 | +#import "CNLiveUserInfoNotification.h" | |
| 17 | + | |
| 16 | 18 | @interface CNLiveMineNavigationBar () |
| 17 | 19 | @property (nonatomic, strong) UIImageView *header; |
| 18 | 20 | @property (nonatomic, strong) UILabel *name; |
| ... | ... | @@ -27,14 +29,34 @@ static const NSInteger margin = 10; |
| 27 | 29 | if(self){ |
| 28 | 30 | self.userInteractionEnabled = YES; |
| 29 | 31 | self.backgroundColor = [UIColor clearColor]; |
| 32 | + [CNLiveUserInfoNotification addUserInfoUpdateObserver:self selector:@selector(userInfoUpdateNotification:)]; | |
| 30 | 33 | [self createSubViews]; |
| 34 | + [self xw_layoutSubviews]; | |
| 31 | 35 | } |
| 32 | 36 | return self; |
| 33 | 37 | } |
| 34 | 38 | |
| 35 | - | |
| 36 | 39 | - (void)dealloc { |
| 37 | 40 | NSLog(@"CNLiveMineNavigationBar -- dealloc"); |
| 41 | + [CNLiveUserInfoNotification removeObserver:self]; | |
| 42 | + | |
| 43 | +} | |
| 44 | + | |
| 45 | +// 实现方法 | |
| 46 | +- (void)userInfoUpdateNotification:(NSNotification *)noti{ | |
| 47 | + //使用userInfo处理消息 | |
| 48 | + NSDictionary *dic = [noti userInfo]; | |
| 49 | + CNLiveUserInfoDataType type = [[dic objectForKey:@"dataType"] integerValue]; | |
| 50 | + NSString *info = [dic objectForKey:@"info"]; | |
| 51 | + if(type == CNLiveUserInfoDataTypeHeader){ | |
| 52 | + UIImage *xw_image = [self getImageWithImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[self class]]; | |
| 53 | + [_header sd_setImageWithURL:[NSURL URLWithString:info] placeholderImage:xw_image]; | |
| 54 | + | |
| 55 | + }else if(type == CNLiveUserInfoDataTypeNickname){ | |
| 56 | + _name.text = info; | |
| 57 | + | |
| 58 | + } | |
| 59 | + [self xw_layoutSubviews]; | |
| 38 | 60 | } |
| 39 | 61 | |
| 40 | 62 | - (void)createSubViews { |
| ... | ... | @@ -42,11 +64,9 @@ static const NSInteger margin = 10; |
| 42 | 64 | [self addSubview:self.name]; |
| 43 | 65 | } |
| 44 | 66 | |
| 45 | -- (void)layoutSubviews{ | |
| 46 | - [super layoutSubviews]; | |
| 47 | - | |
| 67 | +- (void)xw_layoutSubviews{ | |
| 48 | 68 | NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:14]}; |
| 49 | - CGFloat width = [@"张晓文" boundingRectWithSize:CGSizeMake(0, 0) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dic context:nil].size.width+margin; | |
| 69 | + CGFloat width = [CNUserShareModel.nickname boundingRectWithSize:CGSizeMake(0, 0) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dic context:nil].size.width+margin; | |
| 50 | 70 | if(width >= SCREEN_WIDTH){ |
| 51 | 71 | width = SCREEN_WIDTH-50; |
| 52 | 72 | } |
| ... | ... | @@ -97,7 +117,6 @@ static const NSInteger margin = 10; |
| 97 | 117 | _name.textColor = [UIColor whiteColor]; |
| 98 | 118 | _name.font = [UIFont systemFontOfSize:14]; |
| 99 | 119 | _name.text = CNUserShareModel.nickname; |
| 100 | - _name.text = @"张晓文"; | |
| 101 | 120 | } |
| 102 | 121 | return _name; |
| 103 | 122 | } | ... | ... |