Commit 1f98dc4476357ba28e70b8301bfd1420c877ffcc

Authored by zhangxiaowen
1 parent 4ba95583

no message

CNLiveMineModule/Classes/Controller/CNLiveMineController.m
@@ -57,8 +57,8 @@ static const CGFloat timeValue = 1.5; @@ -57,8 +57,8 @@ static const CGFloat timeValue = 1.5;
57 @"name":@"常用工具", 57 @"name":@"常用工具",
58 @"style":@"2", 58 @"style":@"2",
59 @"margin":@"10", 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 @"name":@"购买的商品", 64 @"name":@"购买的商品",
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateController.m
@@ -276,7 +276,7 @@ static const CGFloat timeValue = 1.5; @@ -276,7 +276,7 @@ static const CGFloat timeValue = 1.5;
276 [self.textView resignFirstResponder]; 276 [self.textView resignFirstResponder];
277 277
278 switch (self.model.dataType) { 278 switch (self.model.dataType) {
279 - case CNLiveUserInfoDataTypeHead://头像 279 + case CNLiveUserInfoDataTypeHeader://头像
280 { 280 {
281 [self updateHeaderActionSheetView]; 281 [self updateHeaderActionSheetView];
282 } 282 }
@@ -619,7 +619,7 @@ static const CGFloat timeValue = 1.5; @@ -619,7 +619,7 @@ static const CGFloat timeValue = 1.5;
619 _navigationBar.backgroundColor = [UIColor whiteColor]; 619 _navigationBar.backgroundColor = [UIColor whiteColor];
620 _navigationBar.delegate = self; 620 _navigationBar.delegate = self;
621 switch (self.model.dataType) { 621 switch (self.model.dataType) {
622 - case CNLiveUserInfoDataTypeHead: 622 + case CNLiveUserInfoDataTypeHeader:
623 { 623 {
624 UIImage *xw_image = [self getImageWithImageName:@"mine_info_set" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; 624 UIImage *xw_image = [self getImageWithImageName:@"mine_info_set" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]];
625 [_navigationBar.right setImage:xw_image forState:UIControlStateNormal]; 625 [_navigationBar.right setImage:xw_image forState:UIControlStateNormal];
@@ -650,7 +650,7 @@ static const CGFloat timeValue = 1.5; @@ -650,7 +650,7 @@ static const CGFloat timeValue = 1.5;
650 _contentView = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 50)]; 650 _contentView = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 50)];
651 _contentView.backgroundColor = [UIColor whiteColor]; 651 _contentView.backgroundColor = [UIColor whiteColor];
652 switch (self.model.dataType) { 652 switch (self.model.dataType) {
653 - case CNLiveUserInfoDataTypeHead: 653 + case CNLiveUserInfoDataTypeHeader:
654 { 654 {
655 self.view.backgroundColor = [UIColor blackColor]; 655 self.view.backgroundColor = [UIColor blackColor];
656 _contentView.backgroundColor = [UIColor blackColor]; 656 _contentView.backgroundColor = [UIColor blackColor];
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoCell.m
@@ -41,7 +41,7 @@ static const NSInteger margin = 12; @@ -41,7 +41,7 @@ static const NSInteger margin = 12;
41 41
42 - (void)setImage:(UIImage *)image{ 42 - (void)setImage:(UIImage *)image{
43 _image = image; 43 _image = image;
44 - if(self.model.dataType == CNLiveUserInfoDataTypeHead){ 44 + if(self.model.dataType == CNLiveUserInfoDataTypeHeader){
45 _pic.image = image; 45 _pic.image = image;
46 } 46 }
47 } 47 }
@@ -52,7 +52,7 @@ static const NSInteger margin = 12; @@ -52,7 +52,7 @@ static const NSInteger margin = 12;
52 52
53 _content.text = model.info; 53 _content.text = model.info;
54 54
55 - if(model.dataType == CNLiveUserInfoDataTypeHead){ 55 + if(model.dataType == CNLiveUserInfoDataTypeHeader){
56 _pic.backgroundColor = [UIColor whiteColor]; 56 _pic.backgroundColor = [UIColor whiteColor];
57 _pic.contentMode = UIViewContentModeScaleToFill; 57 _pic.contentMode = UIViewContentModeScaleToFill;
58 _pic.layer.masksToBounds = YES; 58 _pic.layer.masksToBounds = YES;
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoModel.h
@@ -18,7 +18,7 @@ typedef NS_ENUM(NSInteger, CNLiveUserInfoLayoutType) { @@ -18,7 +18,7 @@ typedef NS_ENUM(NSInteger, CNLiveUserInfoLayoutType) {
18 18
19 typedef NS_ENUM(NSInteger, CNLiveUserInfoDataType) { 19 typedef NS_ENUM(NSInteger, CNLiveUserInfoDataType) {
20 CNLiveUserInfoDataTypeNickname = 0, 20 CNLiveUserInfoDataTypeNickname = 0,
21 - CNLiveUserInfoDataTypeHead = 1, 21 + CNLiveUserInfoDataTypeHeader = 1,
22 CNLiveUserInfoDataTypeGender = 2, 22 CNLiveUserInfoDataTypeGender = 2,
23 CNLiveUserInfoDataTypeCode = 3, 23 CNLiveUserInfoDataTypeCode = 3,
24 CNLiveUserInfoDataTypeAddress = 4, 24 CNLiveUserInfoDataTypeAddress = 4,
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoModel.m
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 26
27 - (CNLiveUserInfoDataType)dataType{ 27 - (CNLiveUserInfoDataType)dataType{
28 if([self.data isEqualToString:@"0"]){ 28 if([self.data isEqualToString:@"0"]){
29 - return CNLiveUserInfoDataTypeHead; 29 + return CNLiveUserInfoDataTypeHeader;
30 } 30 }
31 else if([self.data isEqualToString:@"1"]){ 31 else if([self.data isEqualToString:@"1"]){
32 return CNLiveUserInfoDataTypeNickname; 32 return CNLiveUserInfoDataTypeNickname;
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.m
@@ -46,7 +46,7 @@ static const NSInteger margin = 20; @@ -46,7 +46,7 @@ static const NSInteger margin = 20;
46 NSDictionary *dic = [noti userInfo]; 46 NSDictionary *dic = [noti userInfo];
47 CNLiveUserInfoDataType type = [[dic objectForKey:@"dataType"] integerValue]; 47 CNLiveUserInfoDataType type = [[dic objectForKey:@"dataType"] integerValue];
48 NSString *info = [dic objectForKey:@"info"]; 48 NSString *info = [dic objectForKey:@"info"];
49 - if(type == CNLiveUserInfoDataTypeHead){ 49 + if(type == CNLiveUserInfoDataTypeHeader){
50 UIImage *xw_image = [self getImageWithImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; 50 UIImage *xw_image = [self getImageWithImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]];
51 [_header sd_setImageWithURL:[NSURL URLWithString:info] placeholderImage:xw_image]; 51 [_header sd_setImageWithURL:[NSURL URLWithString:info] placeholderImage:xw_image];
52 52
@@ -236,7 +236,7 @@ static const NSInteger margin = 20; @@ -236,7 +236,7 @@ static const NSInteger margin = 20;
236 _name.numberOfLines = 1; 236 _name.numberOfLines = 1;
237 _name.textColor = [UIColor whiteColor]; 237 _name.textColor = [UIColor whiteColor];
238 _name.font = [UIFont systemFontOfSize:16]; 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 UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(nameTapDidClicked:)]; 240 UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(nameTapDidClicked:)];
241 [_name addGestureRecognizer:tap]; 241 [_name addGestureRecognizer:tap];
242 242
CNLiveMineModule/Classes/View/CNLiveMineNavigationBar.m
@@ -13,6 +13,8 @@ @@ -13,6 +13,8 @@
13 #import "CNUserInfoManager.h" 13 #import "CNUserInfoManager.h"
14 #import "CNLiveCategory.h" 14 #import "CNLiveCategory.h"
15 15
  16 +#import "CNLiveUserInfoNotification.h"
  17 +
16 @interface CNLiveMineNavigationBar () 18 @interface CNLiveMineNavigationBar ()
17 @property (nonatomic, strong) UIImageView *header; 19 @property (nonatomic, strong) UIImageView *header;
18 @property (nonatomic, strong) UILabel *name; 20 @property (nonatomic, strong) UILabel *name;
@@ -27,14 +29,34 @@ static const NSInteger margin = 10; @@ -27,14 +29,34 @@ static const NSInteger margin = 10;
27 if(self){ 29 if(self){
28 self.userInteractionEnabled = YES; 30 self.userInteractionEnabled = YES;
29 self.backgroundColor = [UIColor clearColor]; 31 self.backgroundColor = [UIColor clearColor];
  32 + [CNLiveUserInfoNotification addUserInfoUpdateObserver:self selector:@selector(userInfoUpdateNotification:)];
30 [self createSubViews]; 33 [self createSubViews];
  34 + [self xw_layoutSubviews];
31 } 35 }
32 return self; 36 return self;
33 } 37 }
34 38
35 -  
36 - (void)dealloc { 39 - (void)dealloc {
37 NSLog(@"CNLiveMineNavigationBar -- dealloc"); 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 - (void)createSubViews { 62 - (void)createSubViews {
@@ -42,11 +64,9 @@ static const NSInteger margin = 10; @@ -42,11 +64,9 @@ static const NSInteger margin = 10;
42 [self addSubview:self.name]; 64 [self addSubview:self.name];
43 } 65 }
44 66
45 -- (void)layoutSubviews{  
46 - [super layoutSubviews];  
47 - 67 +- (void)xw_layoutSubviews{
48 NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:14]}; 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 if(width >= SCREEN_WIDTH){ 70 if(width >= SCREEN_WIDTH){
51 width = SCREEN_WIDTH-50; 71 width = SCREEN_WIDTH-50;
52 } 72 }
@@ -97,7 +117,6 @@ static const NSInteger margin = 10; @@ -97,7 +117,6 @@ static const NSInteger margin = 10;
97 _name.textColor = [UIColor whiteColor]; 117 _name.textColor = [UIColor whiteColor];
98 _name.font = [UIFont systemFontOfSize:14]; 118 _name.font = [UIFont systemFontOfSize:14];
99 _name.text = CNUserShareModel.nickname; 119 _name.text = CNUserShareModel.nickname;
100 - _name.text = @"张晓文";  
101 } 120 }
102 return _name; 121 return _name;
103 } 122 }