Commit 47cff8ae1d0414a60f3eeb1a0c25dae4eaa28533

Authored by zhangxiaowen
1 parent 22da11d4

no message

Showing 23 changed files with 1041 additions and 24 deletions
CNLiveMineModule.podspec
@@ -41,6 +41,7 @@ TODO: 网家家-我的模块. @@ -41,6 +41,7 @@ TODO: 网家家-我的模块.
41 # Controller 41 # Controller
42 s.subspec 'Controller' do |ss| 42 s.subspec 'Controller' do |ss|
43 ss.source_files = 'CNLiveMineModule/Classes/Controller/*.{h,m}' 43 ss.source_files = 'CNLiveMineModule/Classes/Controller/*.{h,m}'
  44 + ss.dependency 'CNLiveMineModule/UserInfo'
44 end 45 end
45 46
46 # View 47 # View
@@ -53,6 +54,11 @@ TODO: 网家家-我的模块. @@ -53,6 +54,11 @@ TODO: 网家家-我的模块.
53 ss.source_files = 'CNLiveMineModule/Classes/Model/*.{h,m}' 54 ss.source_files = 'CNLiveMineModule/Classes/Model/*.{h,m}'
54 end 55 end
55 56
  57 + # 用户信息/个人资料
  58 + s.subspec 'UserInfo' do |ss|
  59 + ss.source_files = 'CNLiveMineModule/Classes/UserInfo/*.{h,m}'
  60 + end
  61 +
56 s.resource_bundles = { 62 s.resource_bundles = {
57 'CNLiveMineModule' => ['CNLiveMineModule/Assets/CNLiveMineModule.xcassets'] 63 'CNLiveMineModule' => ['CNLiveMineModule/Assets/CNLiveMineModule.xcassets']
58 } 64 }
CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_front.imageset/Contents.json renamed to CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_all_front.imageset/Contents.json
@@ -6,12 +6,12 @@ @@ -6,12 +6,12 @@
6 }, 6 },
7 { 7 {
8 "idiom" : "universal", 8 "idiom" : "universal",
9 - "filename" : "mine_front@2x.png", 9 + "filename" : "mine_all_front@2x.png",
10 "scale" : "2x" 10 "scale" : "2x"
11 }, 11 },
12 { 12 {
13 "idiom" : "universal", 13 "idiom" : "universal",
14 - "filename" : "mine_front@3x.png", 14 + "filename" : "mine_all_front@3x.png",
15 "scale" : "3x" 15 "scale" : "3x"
16 } 16 }
17 ], 17 ],
CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_front.imageset/mine_front@2x.png renamed to CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_all_front.imageset/mine_all_front@2x.png

266 Bytes

CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_front.imageset/mine_front@3x.png renamed to CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_all_front.imageset/mine_all_front@3x.png

615 Bytes

CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_info_front.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "mine_info_front@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "mine_info_front@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
CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_info_front.imageset/mine_info_front@2x.png 0 → 100644

1.24 KB

CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_info_front.imageset/mine_info_front@3x.png 0 → 100644

1.51 KB

CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_info_qrcode.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "mine_info_qrcode@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "mine_info_qrcode@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
CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_info_qrcode.imageset/mine_info_qrcode@2x.png 0 → 100644

1.64 KB

CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_info_qrcode.imageset/mine_info_qrcode@3x.png 0 → 100644

1.73 KB

CNLiveMineModule/Classes/Controller/CNLiveMineController.m
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 #import "CNLiveMineHeaderView.h" 15 #import "CNLiveMineHeaderView.h"
16 #import "CNLiveMineCell.h" 16 #import "CNLiveMineCell.h"
17 #import "CNLiveMineModel.h" 17 #import "CNLiveMineModel.h"
  18 +#import "CNLiveUserInfoController.h"
18 19
19 @interface CNLiveMineController()<UITableViewDelegate, UITableViewDataSource, CNLiveMineHeaderViewDelegate, CNLiveMineCellDelegate> 20 @interface CNLiveMineController()<UITableViewDelegate, UITableViewDataSource, CNLiveMineHeaderViewDelegate, CNLiveMineCellDelegate>
20 @property (nonatomic, strong) UITableView *tableView; 21 @property (nonatomic, strong) UITableView *tableView;
@@ -142,8 +143,8 @@ static const NSInteger kHEIGHT = 250; @@ -142,8 +143,8 @@ static const NSInteger kHEIGHT = 250;
142 switch (type) { 143 switch (type) {
143 case CNLiveMineHeaderViewTypeUerInfo: 144 case CNLiveMineHeaderViewTypeUerInfo:
144 { 145 {
145 -// XWUserInfoController *vc = [[XWUserInfoController alloc]init];  
146 -// [self.navigationController pushViewController:vc animated:YES]; 146 + CNLiveUserInfoController *vc = [[CNLiveUserInfoController alloc]init];
  147 + [self.navigationController pushViewController:vc animated:YES];
147 } 148 }
148 break; 149 break;
149 case CNLiveMineHeaderViewTypeCode: 150 case CNLiveMineHeaderViewTypeCode:
@@ -154,8 +155,7 @@ static const NSInteger kHEIGHT = 250; @@ -154,8 +155,7 @@ static const NSInteger kHEIGHT = 250;
154 break; 155 break;
155 case CNLiveMineHeaderViewTypeWintess: 156 case CNLiveMineHeaderViewTypeWintess:
156 { 157 {
157 -// XWAddressController *vc = [[XWAddressController alloc]init];  
158 -// [self.navigationController pushViewController:vc animated:YES]; 158 +
159 } 159 }
160 break; 160 break;
161 161
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateController.h 0 → 100644
  1 +//
  2 +// CNLiveMineController.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +#import "CNLiveUserInfoModel.h"
  11 +
  12 +NS_ASSUME_NONNULL_BEGIN
  13 +@class CNLiveInfoUpdateController;
  14 +
  15 +@protocol CNLiveInfoUpdateDelegate <NSObject>
  16 +- (void)updateSuccess:(CNLiveUserInfoDataType)dataType info:(NSString *)info;
  17 +
  18 +@end
  19 +@interface CNLiveInfoUpdateController : UIViewController
  20 +@property (nonatomic, weak) id<CNLiveInfoUpdateDelegate> delegate;
  21 +
  22 +/**
  23 + * @abstract 对象方法 初始化方法
  24 + *
  25 + * @param model 模型
  26 + */
  27 +- (instancetype)initWithModel:(CNLiveUserInfoModel *)model;
  28 +
  29 +@end
  30 +
  31 +NS_ASSUME_NONNULL_END
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateController.m 0 → 100644
  1 +//
  2 +// CNLiveMineController.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveInfoUpdateController.h"
  10 +#import "QMUIKit.h"
  11 +
  12 +#import "CNLiveUserInfoModel.h"
  13 +#import "CNLiveUserInfoNotification.h"
  14 +
  15 +@interface CNLiveInfoUpdateController ()<UITextFieldDelegate,UITextViewDelegate>
  16 +@property (nonatomic, strong) CNLiveUserInfoModel *model;
  17 +@property (nonatomic, weak) UIButton *rightBtn;
  18 +@property (nonatomic, weak) UITextField *textField;
  19 +@property (nonatomic, weak) UITextView *textView;
  20 +
  21 +@end
  22 +
  23 +@implementation CNLiveInfoUpdateController
  24 +#pragma mark - 初始化方法
  25 +- (instancetype)initWithModel:(CNLiveUserInfoModel *)model{
  26 + self = [super init];
  27 + if (self) {
  28 + self.model = model;
  29 + }
  30 + return self;
  31 +}
  32 +
  33 +#pragma mark - 加载数据
  34 +- (void)sendData {
  35 +
  36 +
  37 +}
  38 +
  39 +#pragma mark - 生命周期
  40 +
  41 +- (void)viewDidLoad {
  42 + [super viewDidLoad];
  43 + self.view.backgroundColor = [UIColor colorWithRed:244.0/255.0 green:244.0/255.0 blue:244.0/255.0 alpha:1.0];
  44 + if (@available(iOS 11, *)) {
  45 + }
  46 + else {
  47 + self.automaticallyAdjustsScrollViewInsets = NO;
  48 + }
  49 + [self createNavigationbar];
  50 + switch (self.model.dataType) {
  51 + case CNLiveUserInfoDataTypeNickname:
  52 + {
  53 + self.title = @"设置昵称";
  54 + [self textField_layoutSubViews];
  55 + self.textField.placeholder = @"请输入昵称";
  56 +
  57 + }
  58 + break;
  59 + case CNLiveUserInfoDataTypeAddress:
  60 + {
  61 + self.title = @"设置地区";
  62 + [self textField_layoutSubViews];
  63 + self.textField.placeholder = @"请输入你所在的地区";
  64 +
  65 + }
  66 + break;
  67 + case CNLiveUserInfoDataTypeIntroduction:
  68 + {
  69 + self.title = @"设置个性签名";
  70 + [self textView_layoutSubViews];
  71 + }
  72 + break;
  73 + default:
  74 + {
  75 +
  76 + }
  77 + break;
  78 +
  79 + }
  80 +
  81 +}
  82 +
  83 +- (void)dealloc {
  84 +
  85 +
  86 +}
  87 +- (void)createNavigationbar{
  88 + UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  89 + rightBtn.frame = CGRectMake(0, 0, 50, 25);
  90 + rightBtn.backgroundColor = [UIColor lightGrayColor];
  91 + rightBtn.userInteractionEnabled = NO;
  92 + rightBtn.titleLabel.font = [UIFont boldSystemFontOfSize:15];
  93 + [rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  94 + [rightBtn setTitle:@"完成" forState:UIControlStateNormal];
  95 + rightBtn.adjustsImageWhenHighlighted = NO;
  96 + [rightBtn addTarget:self action:@selector(rightDidClicked:) forControlEvents:UIControlEventTouchUpInside];
  97 + rightBtn.layer.masksToBounds = YES;
  98 + rightBtn.layer.cornerRadius = 5;
  99 + self.rightBtn = rightBtn;
  100 + UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];
  101 + self.navigationItem.rightBarButtonItem = rightItem;
  102 +}
  103 +- (void)textField_layoutSubViews {
  104 + UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 50)];
  105 + bgView.backgroundColor = [UIColor whiteColor];
  106 + [self.view addSubview:bgView];
  107 +
  108 + UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-30, 50)];
  109 + textField.delegate = self;
  110 + textField.backgroundColor = [UIColor whiteColor];// 设置背景颜色
  111 + textField.textColor = [UIColor blackColor]; // 设置文字的颜色
  112 + textField.clearsOnBeginEditing = YES; // 当第二次输入的时候,清空上一次的内容
  113 + textField.font = [UIFont boldSystemFontOfSize:15.0f];
  114 + textField.clearButtonMode = UITextFieldViewModeWhileEditing; // 编辑的时候会显示出删除全部的小X
  115 + [self.view addSubview:textField];
  116 + self.textField = textField;
  117 + self.textField.text = self.model.content;
  118 +
  119 +}
  120 +
  121 +- (void)textView_layoutSubViews {
  122 + UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 150)];
  123 + bgView.backgroundColor = [UIColor whiteColor];
  124 + [self.view addSubview:bgView];
  125 +
  126 + UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-30, 150)];
  127 + textView.delegate = self;
  128 + textView.backgroundColor = [UIColor whiteColor];// 设置背景颜色
  129 + textView.textColor = [UIColor blackColor]; // 设置文字的颜色
  130 + textView.font = [UIFont boldSystemFontOfSize:15.0f];
  131 + [self.view addSubview:textView];
  132 + self.textView = textView;
  133 + self.textView.text = self.model.content;
  134 +}
  135 +
  136 +#pragma mark - UITextFieldDelegate
  137 +- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
  138 + self.rightBtn.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  139 + self.rightBtn.userInteractionEnabled = YES;
  140 + return YES;
  141 +}
  142 +- (void)textFieldDidBeginEditing:(UITextField *)textField{
  143 +
  144 +}
  145 +- (BOOL)textFieldShouldEndEditing:(UITextField *)textField{
  146 +
  147 + return YES;
  148 +}
  149 +- (void)textFieldDidEndEditing:(UITextField *)textField{
  150 +
  151 +}
  152 +#pragma mark - UITextViewDelegate
  153 +- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
  154 + self.rightBtn.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  155 + self.rightBtn.userInteractionEnabled = YES;
  156 + return YES;
  157 +}
  158 +- (BOOL)textViewShouldEndEditing:(UITextView *)textView{
  159 + return YES;
  160 +}
  161 +
  162 +- (void)textViewDidBeginEditing:(UITextView *)textView{
  163 +
  164 +}
  165 +- (void)textViewDidEndEditing:(UITextView *)textView{
  166 +
  167 +}
  168 +- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
  169 + return YES;
  170 +
  171 +}
  172 +- (void)textViewDidChange:(UITextView *)textView{
  173 +
  174 +}
  175 +
  176 +#pragma mark - 响应方法
  177 +//回退goBack
  178 +- (void)goBack {
  179 + if (self.presentingViewController != nil) {
  180 + [self dismissViewControllerAnimated:YES completion:nil];
  181 +
  182 + }
  183 + else {
  184 + [self.navigationController popViewControllerAnimated:YES];
  185 + }
  186 +}
  187 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  188 + [self.view endEditing:YES];
  189 +}
  190 +- (void)rightDidClicked:(UIButton *)btn{
  191 + switch (self.model.dataType) {
  192 + case CNLiveUserInfoDataTypeNickname://昵称
  193 + case CNLiveUserInfoDataTypeAddress://地区
  194 + {
  195 + [self requestUpdateUserInfo:self.textField.text];
  196 + }
  197 + break;
  198 + case CNLiveUserInfoDataTypeIntroduction://简介
  199 + {
  200 + [self requestUpdateUserInfo:self.textView.text];
  201 + }
  202 + break;
  203 +
  204 + default:
  205 + break;
  206 + }
  207 +
  208 +}
  209 +
  210 +#pragma mark - 私有方法
  211 +- (void)requestUpdateUserInfo:(NSString *)info{
  212 + // 数据请求更新
  213 +
  214 +}
  215 +
  216 +- (void)updateDataType:(CNLiveUserInfoDataType)dataType info:(NSString *)info{
  217 + // 1.数据请求成功后更新cell展示信息
  218 + if (self.delegate && [self.delegate respondsToSelector:@selector(updateSuccess:info:)]) {
  219 + [self.delegate updateSuccess:dataType info:info];
  220 + }
  221 +
  222 + // 2.数据请求成功后通知用户信息更新
  223 + [CNLiveUserInfoNotification postUserInfoUpdateNotificationType:dataType info:info];
  224 +
  225 + // 3.数据请求成功后修改用户模型
  226 +// switch (dataType) {
  227 +// case CNLiveUserInfoDataTypeNickname://昵称
  228 +// {
  229 +// [CNLiveUserManager updateUserInfo:CNLiveUserInfoTypeName info:info];
  230 +// }
  231 +// break;
  232 +// case CNLiveUserInfoDataTypeAddress://地区
  233 +// {
  234 +// [CNLiveUserManager updateUserInfo:CNLiveUserInfoTypeAddress info:info];
  235 +// }
  236 +// break;
  237 +// case CNLiveUserInfoDataTypeIntroduction://简介
  238 +// {
  239 +// [CNLiveUserManager updateUserInfo:CNLiveUserInfoTypeIntroduction info:info];
  240 +//
  241 +// }
  242 +// break;
  243 +//
  244 +// default:
  245 +// break;
  246 +// }
  247 +
  248 +}
  249 +
  250 +@end
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoCell.h 0 → 100644
  1 +//
  2 +// CNLiveMineController.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNLiveUserInfoModel;
  13 +static NSString * const kCNLiveUserInfoCell = @"CNLiveUserInfoCell";
  14 +
  15 +@interface CNLiveUserInfoCell : UITableViewCell
  16 +
  17 +@property (nonatomic, strong) CNLiveUserInfoModel *model;
  18 +@property (nonatomic, strong) UIImage *image;
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoCell.m 0 → 100644
  1 +//
  2 +// CNLiveMineController.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUserInfoCell.h"
  10 +#import <Masonry/Masonry.h>
  11 +#import <SDWebImage/SDWebImage.h>
  12 +#import "CNLiveUserInfoModel.h"
  13 +
  14 +@interface CNLiveUserInfoCell()
  15 +@property (nonatomic, strong) UIView *line;
  16 +@property (nonatomic, strong) UILabel *title;
  17 +@property (nonatomic, strong) UILabel *content;
  18 +@property (nonatomic, strong) UIImageView *front;
  19 +@property (nonatomic, strong) UIImageView *pic;
  20 +
  21 +@end
  22 +
  23 +@implementation CNLiveUserInfoCell
  24 +static const NSInteger margin = 12;
  25 +
  26 +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  27 + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  28 + if (self) {
  29 + self.contentView.backgroundColor = [UIColor whiteColor];
  30 +
  31 + [self.contentView addSubview:self.line];
  32 + [self.contentView addSubview:self.title];
  33 + [self.contentView addSubview:self.content];
  34 + [self.contentView addSubview:self.front];
  35 + [self.contentView addSubview:self.pic];
  36 +
  37 + }
  38 + return self;
  39 +}
  40 +
  41 +- (void)setImage:(UIImage *)image{
  42 + _image = image;
  43 + if(self.model.dataType == CNLiveUserInfoDataTypeHead){
  44 + _pic.image = image;
  45 + }
  46 +}
  47 +
  48 +- (void)setModel:(CNLiveUserInfoModel *)model{
  49 + _model = model;
  50 + _title.text = model.title;
  51 +
  52 + _content.text = model.content;
  53 +
  54 + if(model.dataType == CNLiveUserInfoDataTypeHead){
  55 + _pic.backgroundColor = [UIColor whiteColor];
  56 + _pic.contentMode = UIViewContentModeScaleToFill;
  57 + _pic.layer.masksToBounds = YES;
  58 + _pic.layer.cornerRadius = 2;
  59 + UIImage *xw_image = [self xw_getImageName:model.content bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoCell class]];
  60 + [_pic sd_setImageWithURL:[NSURL URLWithString:@"头像"] placeholderImage:xw_image];
  61 +
  62 + }else if (model.dataType == CNLiveUserInfoDataTypeNickname){
  63 +
  64 +
  65 + }else if (model.dataType == CNLiveUserInfoDataTypeGender){
  66 + if([model.content isEqualToString:@"0"]){
  67 + _content.text = @"男";
  68 + }else if([model.content isEqualToString:@"1"]){
  69 + _content.text = @"女";
  70 + }else{
  71 + _content.text = @"未知";
  72 + }
  73 +
  74 + }else if (model.dataType == CNLiveUserInfoDataTypeCode){
  75 + _pic.contentMode = UIViewContentModeCenter;
  76 + _pic.layer.masksToBounds = NO;
  77 + _pic.layer.cornerRadius = 0.0;
  78 + UIImage *xw_image = [self xw_getImageName:@"mine_info_qrcode" bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoCell class]];
  79 + _pic.image = xw_image;
  80 +
  81 + }else if (model.dataType == CNLiveUserInfoDataTypeAddress){
  82 +
  83 + }else if (model.dataType == CNLiveUserInfoDataTypeIntroduction){
  84 +
  85 + }
  86 +
  87 + [self xw_layoutSubviews];
  88 +}
  89 +
  90 +- (void)xw_layoutSubviews{
  91 +
  92 + CGFloat line_margin = self.model.lineHeight >= 5?0:margin;
  93 +
  94 + [_line mas_updateConstraints:^(MASConstraintMaker *make) {
  95 + make.left.equalTo(self.contentView.mas_left).with.offset(line_margin);
  96 + make.right.equalTo(self.contentView.mas_right).with.offset(-line_margin);
  97 + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0);
  98 + make.height.offset(self.model.lineHeight);
  99 +
  100 + }];
  101 +
  102 + [_title mas_updateConstraints:^(MASConstraintMaker *make) {
  103 + make.left.equalTo(self.contentView.mas_left).with.offset(margin);
  104 + make.top.equalTo(self.contentView.mas_top).with.offset(0);
  105 + make.height.offset(self.model.height-self.model.lineHeight);
  106 +
  107 + }];
  108 +
  109 + [_front mas_updateConstraints:^(MASConstraintMaker *make) {
  110 + make.right.equalTo(self.contentView.mas_right).with.offset(-margin);
  111 + make.top.equalTo(self.title.mas_top).with.offset(0);
  112 + make.width.with.offset(margin);
  113 + make.height.equalTo(self.title.mas_height);
  114 +
  115 + }];
  116 +
  117 + switch (self.model.layoutType) {
  118 + case CNLiveUserInfoLayoutTypeText:
  119 + {
  120 + _content.hidden = NO;
  121 + _pic.hidden = YES;
  122 + [_content mas_updateConstraints:^(MASConstraintMaker *make) {
  123 + make.top.equalTo(self.title.mas_top).with.offset(0);
  124 + make.left.equalTo(self.title.mas_right).with.offset(margin);
  125 + make.right.equalTo(self.front.mas_left).with.offset(-margin);
  126 + make.height.equalTo(self.title.mas_height);
  127 +
  128 + }];
  129 + }
  130 + break;
  131 + case CNLiveUserInfoLayoutTypeImage:
  132 + {
  133 + CGFloat height = self.model.height-self.model.lineHeight-2*margin;
  134 + _content.hidden = YES;
  135 + _pic.hidden = NO;
  136 + [_pic mas_updateConstraints:^(MASConstraintMaker *make) {
  137 + make.top.equalTo(self.contentView.mas_top).with.offset(margin);
  138 + make.right.equalTo(self.front.mas_left).with.offset(-margin);
  139 + make.width.height.offset(height);
  140 +
  141 + }];
  142 +
  143 + }
  144 + break;
  145 +
  146 + default:
  147 + {
  148 + _content.hidden = YES;
  149 + _pic.hidden = YES;
  150 +
  151 + }
  152 + break;
  153 + }
  154 +
  155 +}
  156 +- (void)awakeFromNib {
  157 + [super awakeFromNib];
  158 + // Initialization code
  159 +}
  160 +
  161 +- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  162 + [super setSelected:selected animated:animated];
  163 +
  164 + // Configure the view for the selected state
  165 +}
  166 +#pragma mark - 懒加载
  167 +- (UIView *)line {
  168 + if (!_line) {
  169 + _line = [[UIView alloc] init];
  170 + _line.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1.0];
  171 + }
  172 + return _line;
  173 +}
  174 +
  175 +- (UILabel *)title {
  176 + if (!_title) {
  177 + _title = [[UILabel alloc] init];
  178 + _title.numberOfLines = 1;
  179 + _title.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  180 + _title.font = [UIFont systemFontOfSize:16];
  181 + }
  182 + return _title;
  183 +}
  184 +
  185 +- (UILabel *)content {
  186 + if (!_content) {
  187 + _content = [[UILabel alloc] init];
  188 + _content.numberOfLines = 1;
  189 + _content.lineBreakMode = NSLineBreakByTruncatingTail;
  190 + _content.textColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
  191 + _content.font = [UIFont systemFontOfSize:14];
  192 + }
  193 + return _content;
  194 +}
  195 +
  196 +- (UIImageView *)front {
  197 + if (!_front) {
  198 + _front = [[UIImageView alloc] init];
  199 + UIImage *xw_image = [self xw_getImageName:@"mine_info_front" bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoCell class]];
  200 + _front.image = xw_image;
  201 + _front.contentMode = UIViewContentModeCenter;
  202 +
  203 + }
  204 + return _front;
  205 +}
  206 +- (UIImageView *)pic {
  207 + if (!_pic) {
  208 + _pic = [[UIImageView alloc] init];
  209 + }
  210 + return _pic;
  211 +}
  212 +#pragma mark - 响应方法
  213 +- (void)switchChanged:(UISwitch *)sw{
  214 +
  215 +}
  216 +
  217 +/**
  218 + * 创建图片
  219 + *
  220 + * @param imageName 图片名字
  221 + * @param bundleName 图片所在的bundle名字
  222 + * @param targetClass 类和bundle的同级目录
  223 + * @return 返回UIImage
  224 + */
  225 +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{
  226 + NSBundle *bundle = [NSBundle bundleForClass:targetClass];
  227 + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];
  228 + NSBundle *targetBundle = [NSBundle bundleWithURL:url];
  229 + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];
  230 + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];
  231 +}
  232 +
  233 +@end
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoController.h 0 → 100644
  1 +//
  2 +// CNLiveMineController.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNLiveUserInfoController : UIViewController
  14 +
  15 +@end
  16 +
  17 +NS_ASSUME_NONNULL_END
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoController.m 0 → 100644
  1 +//
  2 +// CNLiveMineController.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUserInfoController.h"
  10 +#import "MJExtension.h"
  11 +#import "QMUIKit.h"
  12 +
  13 +#import "CNLiveUserInfoCell.h"
  14 +#import "CNLiveUserInfoModel.h"
  15 +#import "CNLiveInfoUpdateController.h"
  16 +#import "CNLiveUserInfoNotification.h"
  17 +
  18 +@interface CNLiveUserInfoController ()<UITableViewDelegate, UITableViewDataSource, CNLiveInfoUpdateDelegate>{
  19 + UIImage *_image;
  20 +}
  21 +@property (nonatomic, strong) UITableView *tableView;
  22 +@property (nonatomic, strong) NSMutableArray *data;
  23 +
  24 +@end
  25 +
  26 +@implementation CNLiveUserInfoController
  27 +#pragma mark - 加载数据
  28 +- (void)loadData {
  29 + NSArray *data = @[
  30 + @{
  31 + @"layout":@"2",
  32 + @"data":@"0",
  33 + @"title":@"头像",
  34 + @"content":@"default_avatar_f",
  35 + @"height":@"81",
  36 + @"lineHeight":@"0.5"
  37 + },
  38 + @{
  39 + @"layout":@"1",
  40 + @"data":@"1",
  41 + @"title":@"昵称",
  42 + @"content":@"User_Name",
  43 + @"height":@"51",
  44 + @"lineHeight":@"0.5"
  45 + },
  46 + @{
  47 + @"layout":@"1",
  48 + @"data":@"2",
  49 + @"title":@"性别",
  50 + @"content":@"User_Gender",
  51 + @"height":@"60",
  52 + @"lineHeight":@"10"
  53 + },
  54 + @{
  55 + @"layout":@"2",
  56 + @"data":@"3",
  57 + @"title":@"二维码",
  58 + @"content":@"二维码",
  59 + @"height":@"51",
  60 + @"lineHeight":@"0.5"
  61 + },
  62 + @{
  63 + @"layout":@"1",
  64 + @"data":@"4",
  65 + @"title":@"地区",
  66 + @"content":@"User_Address",
  67 + @"height":@"60",
  68 + @"lineHeight":@"10"
  69 + },
  70 + @{
  71 + @"layout":@"1",
  72 + @"data":@"5",
  73 + @"title":@"个性签名",
  74 +// @"content":User_Introduction?User_Introduction:@"这个人很懒!!!",
  75 + @"content":@"这个人很懒!!!",
  76 + @"height":@"51",
  77 + @"lineHeight":@"0.5"
  78 + }
  79 +
  80 + ];
  81 + for(NSDictionary *dic in data){
  82 + [self.data addObject:[CNLiveUserInfoModel mj_objectWithKeyValues:dic]];
  83 + }
  84 + [self.tableView reloadData];
  85 +
  86 +}
  87 +
  88 +#pragma mark - 生命周期
  89 +- (void)viewWillAppear:(BOOL)animated{
  90 + [super viewWillAppear:animated];
  91 + self.navigationController.navigationBarHidden = NO;
  92 +}
  93 +
  94 +- (void)viewDidLoad {
  95 + [super viewDidLoad];
  96 + self.view.backgroundColor = [UIColor whiteColor];
  97 + if (@available(iOS 11, *)) {
  98 + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  99 + }
  100 + else {
  101 + self.automaticallyAdjustsScrollViewInsets = NO;
  102 + }
  103 + [self createSubViews];
  104 + [self loadData];
  105 +
  106 +}
  107 +
  108 +- (void)dealloc {
  109 +
  110 +
  111 +}
  112 +
  113 +- (void)createSubViews {
  114 + self.title = @"个人资料";
  115 + [self.view addSubview:self.tableView];
  116 +
  117 +}
  118 +
  119 +#pragma mark - UITableViewDelegate
  120 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  121 + CNLiveUserInfoModel *model = self.data[indexPath.row];
  122 + return model.height;
  123 +}
  124 +
  125 +#pragma mark - UITableViewDataSource
  126 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  127 + return self.data.count;
  128 +}
  129 +
  130 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  131 + CNLiveUserInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveUserInfoCell];
  132 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  133 + CNLiveUserInfoModel *model = self.data[indexPath.row];
  134 + cell.model = model;
  135 + if(_image){
  136 + cell.image = _image;
  137 + }
  138 + return cell;
  139 +}
  140 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  141 + CNLiveUserInfoModel *model = self.data[indexPath.row];
  142 + switch (model.dataType) {
  143 + case CNLiveUserInfoDataTypeHead:
  144 + {
  145 + [self updateHeaderActionSheetView];
  146 + }
  147 + break;
  148 + case CNLiveUserInfoDataTypeNickname:
  149 + {
  150 + CNLiveInfoUpdateController *vc = [[CNLiveInfoUpdateController alloc]initWithModel:model];
  151 + vc.delegate = self;
  152 + [self.navigationController pushViewController:vc animated:YES];
  153 + }
  154 + break;
  155 + case CNLiveUserInfoDataTypeGender:
  156 + {
  157 + [self updateGenderActionSheetView];
  158 + }
  159 + break;
  160 + case CNLiveUserInfoDataTypeCode:
  161 + {
  162 +// CNLiveMyQrCodeController *vc = [[CNLiveMyQrCodeController alloc]init];
  163 +// [self.navigationController pushViewController:vc animated:YES];
  164 + }
  165 + break;
  166 + case CNLiveUserInfoDataTypeAddress:
  167 + {
  168 + CNLiveInfoUpdateController *vc = [[CNLiveInfoUpdateController alloc]initWithModel:model];
  169 + vc.delegate = self;
  170 + [self.navigationController pushViewController:vc animated:YES];
  171 + }
  172 + break;
  173 + case CNLiveUserInfoDataTypeIntroduction:
  174 + {
  175 + CNLiveInfoUpdateController *vc = [[CNLiveInfoUpdateController alloc]initWithModel:model];
  176 + vc.delegate = self;
  177 + [self.navigationController pushViewController:vc animated:YES];
  178 + }
  179 + break;
  180 +
  181 + default:
  182 + break;
  183 + }
  184 +}
  185 +#pragma mark - CNLiveInfoUpdateDelegate
  186 +- (void)updateSuccess:(CNLiveUserInfoDataType)dataType info:(NSString *)info{
  187 + [self updateDataType:dataType info:info];
  188 +}
  189 +
  190 +#pragma mark - 私有方法
  191 +// 修改头像
  192 +- (void)updateHeaderActionSheetView{
  193 + __weak typeof(self) weakSelf = self;
  194 +
  195 +}
  196 +
  197 +// 更新头像
  198 +- (void)requestUpdateUserHeader:(UIImage *)image{
  199 + // 数据请求更新
  200 +
  201 +
  202 +}
  203 +
  204 +// 修改性别
  205 +- (void)updateGenderActionSheetView{
  206 + __weak typeof(self) weakSelf = self;
  207 +
  208 +}
  209 +
  210 +// 更新性别
  211 +- (void)requestUpdateUserGender:(NSString *)gender{
  212 + // 数据请求更新
  213 +
  214 +
  215 +}
  216 +// 更新cell展示信息
  217 +- (void)updateDataType:(CNLiveUserInfoDataType)dataType info:(NSString *)info{
  218 + for(CNLiveUserInfoModel *model in self.data){
  219 + if(dataType == model.dataType){
  220 + model.content = info;
  221 + break;
  222 + }
  223 + }
  224 + [self.tableView reloadData];
  225 +}
  226 +
  227 +#pragma mark - 懒加载
  228 +- (NSMutableArray *)data {
  229 + if (!_data) {
  230 + _data = [NSMutableArray array];
  231 + }
  232 + return _data;
  233 +}
  234 +
  235 +- (UITableView *)tableView{
  236 + if(!_tableView){
  237 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop) style:UITableViewStylePlain];
  238 + _tableView.delegate = self;
  239 + _tableView.dataSource = self;
  240 + _tableView.bounces = NO;
  241 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  242 + _tableView.backgroundColor = [UIColor whiteColor];
  243 + _tableView.estimatedRowHeight = 0;
  244 + _tableView.estimatedSectionHeaderHeight = 0;
  245 + _tableView.estimatedSectionFooterHeight = 0;
  246 + [_tableView registerClass:[CNLiveUserInfoCell class] forCellReuseIdentifier:kCNLiveUserInfoCell];
  247 + }
  248 + return _tableView;
  249 +}
  250 +
  251 +#pragma mark - 响应方法
  252 +- (void)goBack {
  253 + if (self.presentingViewController != nil) {
  254 + [self dismissViewControllerAnimated:YES completion:nil];
  255 + }
  256 + else {
  257 + [self.navigationController popViewControllerAnimated:YES];
  258 + }
  259 +}
  260 +
  261 +@end
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoModel.h 0 → 100644
  1 +//
  2 +// CNLiveMineController.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +typedef NS_ENUM(NSInteger, CNLiveUserInfoLayoutType) {
  14 + CNLiveUserInfoLayoutTypeDefault = 0,
  15 + CNLiveUserInfoLayoutTypeText = 1,
  16 + CNLiveUserInfoLayoutTypeImage = 2
  17 +};
  18 +
  19 +typedef NS_ENUM(NSInteger, CNLiveUserInfoDataType) {
  20 + CNLiveUserInfoDataTypeNickname = 0,
  21 + CNLiveUserInfoDataTypeHead = 1,
  22 + CNLiveUserInfoDataTypeGender = 2,
  23 + CNLiveUserInfoDataTypeCode = 3,
  24 + CNLiveUserInfoDataTypeAddress = 4,
  25 + CNLiveUserInfoDataTypeIntroduction = 5
  26 +
  27 +};
  28 +
  29 +
  30 +@interface CNLiveUserInfoModel : NSObject
  31 +@property (nonatomic, copy) NSString *title;
  32 +@property (nonatomic, copy) NSString *content;
  33 +@property (nonatomic, copy) NSString *layout;
  34 +@property (nonatomic, copy) NSString *data;
  35 +
  36 +@property (nonatomic, assign) CNLiveUserInfoLayoutType layoutType;
  37 +@property (nonatomic, assign) CNLiveUserInfoDataType dataType;
  38 +
  39 +@property (nonatomic, assign) CGFloat height;
  40 +@property (nonatomic, assign) CGFloat lineHeight;
  41 +
  42 +@end
  43 +
  44 +NS_ASSUME_NONNULL_END
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoModel.m 0 → 100644
  1 +//
  2 +// CNLiveMineController.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUserInfoModel.h"
  10 +
  11 +@implementation CNLiveUserInfoModel
  12 +- (CNLiveUserInfoLayoutType)layoutType{
  13 + if([self.layout isEqualToString:@"0"]){
  14 + return CNLiveUserInfoLayoutTypeDefault;
  15 + }
  16 + else if([self.layout isEqualToString:@"1"]){
  17 + return CNLiveUserInfoLayoutTypeText;
  18 +
  19 + }
  20 + else if([self.layout isEqualToString:@"2"]){
  21 + return CNLiveUserInfoLayoutTypeImage;
  22 +
  23 + }
  24 + return CNLiveUserInfoLayoutTypeDefault;
  25 +}
  26 +
  27 +- (CNLiveUserInfoDataType)dataType{
  28 + if([self.data isEqualToString:@"0"]){
  29 + return CNLiveUserInfoDataTypeHead;
  30 + }
  31 + else if([self.data isEqualToString:@"1"]){
  32 + return CNLiveUserInfoDataTypeNickname;
  33 +
  34 + }
  35 + else if([self.data isEqualToString:@"2"]){
  36 + return CNLiveUserInfoDataTypeGender;
  37 +
  38 + }
  39 + else if([self.data isEqualToString:@"3"]){
  40 + return CNLiveUserInfoDataTypeCode;
  41 +
  42 + }
  43 + else if([self.data isEqualToString:@"4"]){
  44 + return CNLiveUserInfoDataTypeAddress;
  45 +
  46 + }
  47 + else if([self.data isEqualToString:@"5"]){
  48 + return CNLiveUserInfoDataTypeIntroduction;
  49 +
  50 + }
  51 + return CNLiveUserInfoDataTypeNickname;
  52 +}
  53 +
  54 +@end
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoNotification.h 0 → 100644
  1 +//
  2 +// CNLiveUserInfoNotification.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +#import "CNLiveUserInfoModel.h"
  11 +
  12 +NS_ASSUME_NONNULL_BEGIN
  13 +
  14 +@interface CNLiveUserInfoNotification : NSObject
  15 ++ (void)postUserInfoUpdateNotificationType:(CNLiveUserInfoDataType)type info:(id)info;
  16 +//NSDictionary *dic = @{@"type":@(type),@"info":info};
  17 ++ (void)addUserInfoUpdateObserver:(id)observer selector:(SEL)selector;
  18 +
  19 ++ (void)removeObserver:(id)observer;
  20 +
  21 +@end
  22 +
  23 +NS_ASSUME_NONNULL_END
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoNotification.m 0 → 100644
  1 +//
  2 +// CNLiveUserInfoNotification.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUserInfoNotification.h"
  10 +
  11 +@implementation CNLiveUserInfoNotification
  12 +static NSString * const kCNLiveUserInfoUpdateNotification = @"CNLiveUserInfoUpdateNotification";
  13 +
  14 ++ (void)postUserInfoUpdateNotificationType:(CNLiveUserInfoDataType)type info:(id)info{
  15 + NSDictionary *dic = @{@"type":@(type),@"info":info};
  16 + [[NSNotificationCenter defaultCenter] postNotificationName:kCNLiveUserInfoUpdateNotification object:nil userInfo:dic];
  17 +
  18 +}
  19 +
  20 ++ (void)addUserInfoUpdateObserver:(id)observer selector:(SEL)selector{
  21 + [[NSNotificationCenter defaultCenter] addObserver:observer selector:selector name:kCNLiveUserInfoUpdateNotification object:nil];
  22 +
  23 +}
  24 +
  25 ++ (void)removeObserver:(id)observer{
  26 + [[NSNotificationCenter defaultCenter] removeObserver:observer];
  27 +
  28 +}
  29 +
  30 +@end
CNLiveMineModule/Classes/View/CNLiveMineCell.m
@@ -291,10 +291,10 @@ @@ -291,10 +291,10 @@
291 if(!_allButton){ 291 if(!_allButton){
292 _allButton = [UIButton buttonWithType:UIButtonTypeCustom]; 292 _allButton = [UIButton buttonWithType:UIButtonTypeCustom];
293 [_allButton setTitle:@"查看全部" forState:UIControlStateNormal]; 293 [_allButton setTitle:@"查看全部" forState:UIControlStateNormal];
294 - UIImage *xw_image = [self xw_getImageName:@"mine_front" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineCell class]]; 294 + UIImage *xw_image = [self xw_getImageName:@"mine_all_front" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineCell class]];
295 [_allButton setImage:xw_image forState:UIControlStateNormal]; 295 [_allButton setImage:xw_image forState:UIControlStateNormal];
296 [_allButton setImage:xw_image forState:UIControlStateHighlighted]; 296 [_allButton setImage:xw_image forState:UIControlStateHighlighted];
297 - _allButton.titleLabel.font = [UIFont boldSystemFontOfSize:12]; 297 + _allButton.titleLabel.font = [UIFont systemFontOfSize:12];
298 [_allButton setTitleColor:[UIColor colorWithRed:190.0/255.0 green:190.0/255.0 blue:190.0/255.0 alpha:1.0] forState:UIControlStateNormal]; 298 [_allButton setTitleColor:[UIColor colorWithRed:190.0/255.0 green:190.0/255.0 blue:190.0/255.0 alpha:1.0] forState:UIControlStateNormal];
299 _allButton.adjustsImageWhenHighlighted = NO; 299 _allButton.adjustsImageWhenHighlighted = NO;
300 [_allButton addTarget:self action:@selector(allBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; 300 [_allButton addTarget:self action:@selector(allBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside];
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.m
@@ -219,14 +219,8 @@ static const NSInteger margin = 20; @@ -219,14 +219,8 @@ static const NSInteger margin = 20;
219 _header.layer.cornerRadius = 30; 219 _header.layer.cornerRadius = 30;
220 UIImage *xw_image = [self xw_getImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; 220 UIImage *xw_image = [self xw_getImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]];
221 [_header sd_setImageWithURL:[NSURL URLWithString:@"头像"] placeholderImage:xw_image]; 221 [_header sd_setImageWithURL:[NSURL URLWithString:@"头像"] placeholderImage:xw_image];
222 - __weak typeof(self) weakSelf = self;  
223 -// [_header addGestureTapEventHandle:^(id _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {  
224 -// __strong typeof(weakSelf) strongSelf = weakSelf;  
225 -// if(!strongSelf) return ;  
226 -// if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(headerView:pushToController:)]) {  
227 -// [strongSelf.delegate headerView:strongSelf pushToController:CNLiveMineHeaderViewTypeUerInfo];  
228 -// }  
229 -// }]; 222 + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(headerTapDidClicked:)];
  223 + [_header addGestureRecognizer:tap];
230 } 224 }
231 return _header; 225 return _header;
232 } 226 }
@@ -239,14 +233,8 @@ static const NSInteger margin = 20; @@ -239,14 +233,8 @@ static const NSInteger margin = 20;
239 _name.textColor = [UIColor whiteColor]; 233 _name.textColor = [UIColor whiteColor];
240 _name.font = [UIFont systemFontOfSize:16]; 234 _name.font = [UIFont systemFontOfSize:16];
241 _name.attributedText = [self createAttributedImageName:@"mine_code" string:@"张晓文" isFront:NO]; 235 _name.attributedText = [self createAttributedImageName:@"mine_code" string:@"张晓文" isFront:NO];
242 - __weak typeof(self) weakSelf = self;  
243 -// [_name addGestureTapEventHandle:^(id _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {  
244 -// __strong typeof(weakSelf) strongSelf = weakSelf;  
245 -// if(!strongSelf) return ;  
246 -// if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(headerView:pushToController:)]) {  
247 -// [strongSelf.delegate headerView:strongSelf pushToController:CNLiveMineHeaderViewTypeCode];  
248 -// }  
249 -// }]; 236 + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(nameTapDidClicked:)];
  237 + [_name addGestureRecognizer:tap];
250 238
251 } 239 }
252 return _name; 240 return _name;
@@ -292,6 +280,20 @@ static const NSInteger margin = 20; @@ -292,6 +280,20 @@ static const NSInteger margin = 20;
292 } 280 }
293 281
294 #pragma mark - 响应方法 282 #pragma mark - 响应方法
  283 +- (void)headerTapDidClicked:(UITapGestureRecognizer *)tap{
  284 + if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) {
  285 + [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeUerInfo];
  286 +
  287 + }
  288 +
  289 +}
  290 +- (void)nameTapDidClicked:(UITapGestureRecognizer *)tap{
  291 + if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) {
  292 + [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeCode];
  293 +
  294 + }
  295 +
  296 +}
295 - (void)signDidClicked:(UIButton *)btn{ 297 - (void)signDidClicked:(UIButton *)btn{
296 if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) { 298 if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) {
297 [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeSign]; 299 [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeSign];