Commit f1f6abd5c6a5ddf1bca8e7f987859cb60d9ec723
1 parent
2783fcea
no message
Showing
7 changed files
with
460 additions
and
198 deletions
CNLiveMineModule.podspec
| @@ -68,6 +68,7 @@ TODO: 网家家-我的模块. | @@ -68,6 +68,7 @@ TODO: 网家家-我的模块. | ||
| 68 | # s.dependency 'AFNetworking', '~> 2.3' | 68 | # s.dependency 'AFNetworking', '~> 2.3' |
| 69 | 69 | ||
| 70 | # pod | 70 | # pod |
| 71 | + s.dependency 'CNLiveSDKs/CNLiveUserSystemSDK', '~> 0.3.1.3' #GitHub所以指定版本号 | ||
| 71 | s.dependency 'CNLiveTripartiteManagement/QMUIKit' | 72 | s.dependency 'CNLiveTripartiteManagement/QMUIKit' |
| 72 | s.dependency 'CNLiveTripartiteManagement/SDWebImage' | 73 | s.dependency 'CNLiveTripartiteManagement/SDWebImage' |
| 73 | s.dependency 'CNLiveTripartiteManagement/Masonry' | 74 | s.dependency 'CNLiveTripartiteManagement/Masonry' |
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateController.m
| @@ -9,24 +9,46 @@ | @@ -9,24 +9,46 @@ | ||
| 9 | #import "CNLiveInfoUpdateController.h" | 9 | #import "CNLiveInfoUpdateController.h" |
| 10 | #import "QMUIKit.h" | 10 | #import "QMUIKit.h" |
| 11 | #import <SDWebImage/SDWebImage.h> | 11 | #import <SDWebImage/SDWebImage.h> |
| 12 | +#import <Masonry/Masonry.h> | ||
| 12 | 13 | ||
| 14 | +#import <AVFoundation/AVCaptureDevice.h> | ||
| 15 | +#import <AVFoundation/AVMediaFormat.h> | ||
| 16 | +#import "XFCameraController.h" | ||
| 17 | +#import "TZImagePickerController.h" | ||
| 13 | #import "CNUserInfoManager.h" | 18 | #import "CNUserInfoManager.h" |
| 19 | +#import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h> | ||
| 20 | +#import <CNLiveUserSystemSDK/CNLiveUserSystemTypeDef.h> | ||
| 21 | +#import "NSString+CNLiveExtension.h" | ||
| 22 | +#import "NSDictionary+Safety.h" | ||
| 23 | + | ||
| 24 | +#import "CNLiveAddScoreManager.h" | ||
| 25 | +#import "CNLiveGoldWhereaboutsView.h" | ||
| 14 | 26 | ||
| 15 | #import "CNLiveUserInfoModel.h" | 27 | #import "CNLiveUserInfoModel.h" |
| 16 | #import "CNLiveUserInfoNotification.h" | 28 | #import "CNLiveUserInfoNotification.h" |
| 17 | #import "CNLiveUserInfoNavigationBar.h" | 29 | #import "CNLiveUserInfoNavigationBar.h" |
| 18 | 30 | ||
| 19 | -@interface CNLiveInfoUpdateController ()<UITextFieldDelegate,UITextViewDelegate,CNLiveUserInfoNavigationBarDelegate,QMUIAlertControllerDelegate> | 31 | +@interface CNLiveInfoUpdateController ()<UITextFieldDelegate,UITextViewDelegate,CNLiveUserInfoNavigationBarDelegate,QMUIAlertControllerDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate>{ |
| 32 | + UIImage *_image; | ||
| 33 | +} | ||
| 20 | @property (nonatomic, strong) CNLiveUserInfoNavigationBar *navigationBar; | 34 | @property (nonatomic, strong) CNLiveUserInfoNavigationBar *navigationBar; |
| 21 | @property (nonatomic, strong) CNLiveUserInfoModel *model; | 35 | @property (nonatomic, strong) CNLiveUserInfoModel *model; |
| 22 | 36 | ||
| 37 | +@property (nonatomic, strong) UIView *contentView; | ||
| 38 | + | ||
| 23 | @property (nonatomic, strong) UIImageView *imageView; | 39 | @property (nonatomic, strong) UIImageView *imageView; |
| 24 | -@property (nonatomic, weak) UITextField *textField; | ||
| 25 | -@property (nonatomic, weak) UITextView *textView; | 40 | +@property (nonatomic, strong) UITextField *textField; |
| 41 | +@property (nonatomic, strong) UITextView *textView; | ||
| 42 | +@property (nonatomic, strong) UILabel *textNum; | ||
| 26 | 43 | ||
| 27 | @end | 44 | @end |
| 28 | 45 | ||
| 29 | @implementation CNLiveInfoUpdateController | 46 | @implementation CNLiveInfoUpdateController |
| 47 | + | ||
| 48 | +#define _locMaxLength 12 | ||
| 49 | +#define _nickMaxLength 20 | ||
| 50 | +#define MAX_LIMIT_NUMS 30 | ||
| 51 | + | ||
| 30 | static const NSInteger margin = 15; | 52 | static const NSInteger margin = 15; |
| 31 | static const CGFloat timeValue = 1.5; | 53 | static const CGFloat timeValue = 1.5; |
| 32 | 54 | ||
| @@ -39,12 +61,6 @@ static const CGFloat timeValue = 1.5; | @@ -39,12 +61,6 @@ static const CGFloat timeValue = 1.5; | ||
| 39 | return self; | 61 | return self; |
| 40 | } | 62 | } |
| 41 | 63 | ||
| 42 | -#pragma mark - 加载数据 | ||
| 43 | -- (void)sendData { | ||
| 44 | - | ||
| 45 | - | ||
| 46 | -} | ||
| 47 | - | ||
| 48 | #pragma mark - 生命周期 | 64 | #pragma mark - 生命周期 |
| 49 | - (void)viewWillAppear:(BOOL)animated{ | 65 | - (void)viewWillAppear:(BOOL)animated{ |
| 50 | [super viewWillAppear:animated]; | 66 | [super viewWillAppear:animated]; |
| @@ -60,151 +76,224 @@ static const CGFloat timeValue = 1.5; | @@ -60,151 +76,224 @@ static const CGFloat timeValue = 1.5; | ||
| 60 | self.automaticallyAdjustsScrollViewInsets = NO; | 76 | self.automaticallyAdjustsScrollViewInsets = NO; |
| 61 | } | 77 | } |
| 62 | [self.view addSubview:self.navigationBar]; | 78 | [self.view addSubview:self.navigationBar]; |
| 63 | - switch (self.model.dataType) { | ||
| 64 | - case CNLiveUserInfoDataTypeHead: | ||
| 65 | - { | ||
| 66 | - self.navigationBar.title.text = @"个人头像"; | ||
| 67 | - [self image_layoutSubViews]; | ||
| 68 | - } | ||
| 69 | - break; | ||
| 70 | - case CNLiveUserInfoDataTypeNickname: | ||
| 71 | - { | ||
| 72 | - self.navigationBar.title.text = @"设置昵称"; | ||
| 73 | - [self textField_layoutSubViews]; | ||
| 74 | - self.textField.placeholder = @"请输入昵称"; | 79 | + [self.view addSubview:self.contentView]; |
| 80 | + | ||
| 81 | +} | ||
| 75 | 82 | ||
| 83 | +#pragma mark - UITextFieldDelegate | ||
| 84 | +- (void)textFieldDidChange:(UITextField *)textField { | ||
| 85 | + self.navigationBar.right.userInteractionEnabled = YES; | ||
| 86 | + self.navigationBar.right.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0]; | ||
| 87 | + | ||
| 88 | + NSString *toBeString = textField.text; | ||
| 89 | + | ||
| 90 | + UITextRange *selectedRange = [textField markedTextRange]; | ||
| 91 | + UITextPosition *position = [textField positionFromPosition:selectedRange.start offset:0]; | ||
| 92 | + | ||
| 93 | + // 没有高亮选择的字,则对已输入的文字进行字数统计和限制,防止中文被截断 | ||
| 94 | + if (!position){ | ||
| 95 | + NSInteger maxLength; | ||
| 96 | + maxLength = (self.model.dataType == CNLiveUserInfoDataTypeNickname) ? _nickMaxLength : _locMaxLength; | ||
| 97 | + if (toBeString.length > maxLength){ | ||
| 98 | + //中文和emoj表情存在问题,需要对此进行处理 | ||
| 99 | + NSRange rangeRange = [toBeString rangeOfComposedCharacterSequencesForRange:NSMakeRange(0, maxLength)]; | ||
| 100 | + textField.text = [toBeString substringWithRange:rangeRange]; | ||
| 76 | } | 101 | } |
| 77 | - break; | ||
| 78 | - case CNLiveUserInfoDataTypeAddress: | ||
| 79 | - { | ||
| 80 | - self.navigationBar.title.text = @"设置地区"; | ||
| 81 | - [self textField_layoutSubViews]; | ||
| 82 | - self.textField.placeholder = @"请输入你所在的地区"; | 102 | + } |
| 103 | +} | ||
| 104 | + | ||
| 105 | +#pragma mark - UITextFieldDelegate | ||
| 106 | +- (BOOL)textFieldShouldReturn:(UITextField *)textField { | ||
| 107 | +// [self compleBtnAction:nil]; | ||
| 108 | + return YES; | ||
| 109 | +} | ||
| 83 | 110 | ||
| 111 | +#pragma mark - UITextViewDelegate | ||
| 112 | +- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { | ||
| 113 | + self.navigationBar.right.userInteractionEnabled = YES; | ||
| 114 | + self.navigationBar.right.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0]; | ||
| 115 | + | ||
| 116 | + if([text length] != 0) { | ||
| 117 | + NSLog(@"增"); | ||
| 118 | + if ([[text removeNewLine] length] == 0) { //换行 | ||
| 119 | +// [self compleBtnAction:nil]; | ||
| 120 | + return NO; | ||
| 84 | } | 121 | } |
| 85 | - break; | ||
| 86 | - case CNLiveUserInfoDataTypeIntroduction: | ||
| 87 | - { | ||
| 88 | - self.navigationBar.title.text = @"设置个性签名"; | ||
| 89 | - [self textView_layoutSubViews]; | 122 | + } |
| 123 | + else { | ||
| 124 | + NSLog(@"删"); | ||
| 125 | + return YES; | ||
| 126 | + } | ||
| 127 | + NSLog(@"%lu",(unsigned long)textView.text.length); | ||
| 128 | + | ||
| 129 | + UITextRange *selectedRange = [textView markedTextRange]; //获取高亮部分 | ||
| 130 | + UITextPosition *pos = [textView positionFromPosition:selectedRange.start offset:0]; | ||
| 131 | + NSString *selectedtext = [textView textInRange:selectedRange]; //获取高亮部分内容 | ||
| 132 | + | ||
| 133 | + //如果有高亮且当前字数开始位置小于最大限制时允许输入 | ||
| 134 | + if (selectedRange && pos) { | ||
| 135 | + NSInteger startOffset = [textView offsetFromPosition:textView.beginningOfDocument toPosition:selectedRange.start]; | ||
| 136 | + NSInteger endOffset = [textView offsetFromPosition:textView.beginningOfDocument toPosition:selectedRange.end]; | ||
| 137 | + NSRange offsetRange = NSMakeRange(startOffset, endOffset - startOffset); | ||
| 138 | + | ||
| 139 | + if (offsetRange.location < MAX_LIMIT_NUMS && offsetRange.location+selectedtext.length <= MAX_LIMIT_NUMS && offsetRange.location+text.length <= MAX_LIMIT_NUMS) { | ||
| 140 | + return YES; | ||
| 90 | } | 141 | } |
| 91 | - break; | ||
| 92 | - default: | ||
| 93 | - { | ||
| 94 | - | 142 | + else { |
| 143 | + return NO; | ||
| 95 | } | 144 | } |
| 96 | - break; | ||
| 97 | - | ||
| 98 | } | 145 | } |
| 99 | 146 | ||
| 100 | -} | 147 | + NSString *comcatstr = [textView.text stringByReplacingCharactersInRange:range withString:text];//拼上 |
| 148 | + NSInteger caninputlen = MAX_LIMIT_NUMS - comcatstr.length;//最大减全拼上(拼后剩/超) | ||
| 149 | + if (caninputlen >= 0) { | ||
| 150 | + return YES; | ||
| 151 | + } | ||
| 152 | + else { | ||
| 153 | + NSInteger len = text.length + caninputlen; //原本剩余的空间 | ||
| 154 | + //防止当text.length + caninputlen < 0时,使得rg.length为一个非法最大正数出错 | ||
| 155 | + NSRange rg = {0,MAX(len,0)}; | ||
| 156 | + | ||
| 157 | + if (rg.length > 0) { | ||
| 158 | + NSString *s = @"";//正确待拼text | ||
| 159 | + //判断是否只普通的字符或asc码(对于中文和表情返回NO) | ||
| 160 | + BOOL asc = [text canBeConvertedToEncoding:NSASCIIStringEncoding]; | ||
| 161 | + if (asc) { | ||
| 162 | + s = [text substringWithRange:rg];//因为是ascii码直接取就可以了不会错 | ||
| 163 | + } | ||
| 164 | + else { | ||
| 165 | + __block NSInteger idx = 0; | ||
| 166 | + __block NSString *trimString = @"";//截取出的字串 | ||
| 167 | + //使用字符串遍历,这个方法能准确知道每个emoji是占一个unicode还是两个 | ||
| 168 | + [text enumerateSubstringsInRange:NSMakeRange(0, [text length]) | ||
| 169 | + options:NSStringEnumerationByComposedCharacterSequences | ||
| 170 | + usingBlock: ^(NSString* substring, NSRange substringRange, NSRange enclosingRange, BOOL* stop) { | ||
| 171 | + | ||
| 172 | + NSInteger steplen = substring.length; | ||
| 173 | + if (steplen>rg.length) { | ||
| 174 | + *stop = YES; //取出所需要就break,提高效率 | ||
| 175 | + return ; | ||
| 176 | + } | ||
| 177 | + if (idx >= rg.length) { | ||
| 178 | + *stop = YES; //取出所需要就break,提高效率 | ||
| 179 | + return ; | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + trimString = [trimString stringByAppendingString:substring]; | ||
| 183 | + idx = idx + steplen;//这里变化了,使用了字串占的长度来作为步长 | ||
| 184 | + }]; | ||
| 185 | + | ||
| 186 | + s = trimString; | ||
| 187 | + } | ||
| 188 | + //rang是指从当前光标处进行替换处理(注意如果执行此句后面返回的是YES会触发didchange事件) | ||
| 189 | + [textView setText:[textView.text stringByReplacingCharactersInRange:range withString:s]]; | ||
| 190 | + //既然是超出部分截取了,哪一定是最大限制了。 | ||
| 191 | + self.textNum.text = [NSString stringWithFormat:@"%d",0]; | ||
| 192 | + } | ||
| 193 | + return NO; | ||
| 194 | + } | ||
| 101 | 195 | ||
| 102 | -- (void)dealloc { | ||
| 103 | - | ||
| 104 | - | ||
| 105 | } | 196 | } |
| 106 | 197 | ||
| 107 | -#pragma mark - 更新头像 | ||
| 108 | -- (void)image_layoutSubViews { | ||
| 109 | - self.view.backgroundColor = [UIColor blackColor]; | 198 | +- (void)textViewDidChange:(UITextView *)textView{ |
| 199 | + NSString *nsTextContent = textView.text; //总text | ||
| 200 | + NSInteger existTextNum = nsTextContent.length; //总length | ||
| 110 | 201 | ||
| 111 | - UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH)]; | ||
| 112 | - imageView.center = self.view.center; | ||
| 113 | - imageView.backgroundColor = [UIColor whiteColor];// 设置背景颜色 | ||
| 114 | - UIImage *xw_image = [self xw_getImageName:@"default_avatar_f" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; | ||
| 115 | - [imageView sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.bigFaceUrl?CNUserShareModel.bigFaceUrl:CNUserShareModel.faceUrl] placeholderImage:xw_image]; | ||
| 116 | - [self.view addSubview:imageView]; | ||
| 117 | - self.imageView = imageView; | 202 | + if (existTextNum > MAX_LIMIT_NUMS) { |
| 203 | + //截取到最大位置的字符(由于超出截部分在should时被处理了所在这里这了提高效率不再判断) | ||
| 204 | + NSString *s = [nsTextContent substringToIndex:MAX_LIMIT_NUMS]; | ||
| 205 | + [textView setText:s]; | ||
| 206 | + } | ||
| 207 | + //不让显示负数 | ||
| 208 | + self.textNum.text = [NSString stringWithFormat:@"%ld",MAX(0,MAX_LIMIT_NUMS - existTextNum)]; | ||
| 118 | 209 | ||
| 119 | } | 210 | } |
| 120 | 211 | ||
| 121 | -#pragma mark - 更新昵称/地区 | ||
| 122 | -- (void)textField_layoutSubViews { | ||
| 123 | - UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 50)]; | ||
| 124 | - bgView.backgroundColor = [UIColor whiteColor]; | ||
| 125 | - [self.view addSubview:bgView]; | ||
| 126 | - | ||
| 127 | - UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(margin, NavigationContentTop+margin, SCREEN_WIDTH-2*margin, 50)]; | ||
| 128 | - textField.delegate = self; | ||
| 129 | - textField.backgroundColor = [UIColor whiteColor];// 设置背景颜色 | ||
| 130 | - textField.textColor = [UIColor blackColor]; // 设置文字的颜色 | ||
| 131 | - textField.clearsOnBeginEditing = YES; // 当第二次输入的时候,清空上一次的内容 | ||
| 132 | - textField.font = [UIFont systemFontOfSize:15.0f]; | ||
| 133 | - textField.clearButtonMode = UITextFieldViewModeWhileEditing; // 编辑的时候会显示出删除全部的小X | ||
| 134 | - [self.view addSubview:textField]; | ||
| 135 | - self.textField = textField; | ||
| 136 | - self.textField.text = self.model.content; | ||
| 137 | - | 212 | +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { |
| 213 | + [self.view endEditing:YES]; | ||
| 138 | } | 214 | } |
| 139 | 215 | ||
| 140 | -#pragma mark - 更新个性签名 | ||
| 141 | -- (void)textView_layoutSubViews { | ||
| 142 | - UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 150)]; | ||
| 143 | - bgView.backgroundColor = [UIColor whiteColor]; | ||
| 144 | - [self.view addSubview:bgView]; | ||
| 145 | - | ||
| 146 | - UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(margin, NavigationContentTop+margin, SCREEN_WIDTH-2*margin, 150)]; | ||
| 147 | - textView.delegate = self; | ||
| 148 | - textView.backgroundColor = [UIColor whiteColor];// 设置背景颜色 | ||
| 149 | - textView.textColor = [UIColor blackColor]; // 设置文字的颜色 | ||
| 150 | - textView.font = [UIFont systemFontOfSize:15.0f]; | ||
| 151 | - [self.view addSubview:textView]; | ||
| 152 | - self.textView = textView; | ||
| 153 | - self.textView.text = self.model.content; | ||
| 154 | -} | 216 | +#pragma mark - CNLiveUserInfoNavigationBarDelegate |
| 217 | +- (void)navigationBar:(CNLiveUserInfoNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | ||
| 218 | + if ([actionEvents isEqualToString:@"1"]) { | ||
| 219 | + [self goBack]; | ||
| 220 | + }else if ([actionEvents isEqualToString:@"2"]){ | ||
| 221 | + [self.textField resignFirstResponder]; | ||
| 222 | + [self.textView resignFirstResponder]; | ||
| 155 | 223 | ||
| 156 | -#pragma mark - UITextFieldDelegate | ||
| 157 | -- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{ | ||
| 158 | - self.navigationBar.right.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0]; | ||
| 159 | - self.navigationBar.right.userInteractionEnabled = YES; | ||
| 160 | - return YES; | ||
| 161 | -} | ||
| 162 | -- (void)textFieldDidBeginEditing:(UITextField *)textField{ | ||
| 163 | - | ||
| 164 | -} | ||
| 165 | -- (BOOL)textFieldShouldEndEditing:(UITextField *)textField{ | ||
| 166 | - | ||
| 167 | - return YES; | ||
| 168 | -} | ||
| 169 | -- (void)textFieldDidEndEditing:(UITextField *)textField{ | ||
| 170 | - | 224 | + switch (self.model.dataType) { |
| 225 | + case CNLiveUserInfoDataTypeHead://头像 | ||
| 226 | + { | ||
| 227 | + [self updateHeaderActionSheetView]; | ||
| 228 | + } | ||
| 229 | + break; | ||
| 230 | + case CNLiveUserInfoDataTypeNickname://昵称 | ||
| 231 | + { | ||
| 232 | + [self requestUpdateUserNickname]; | ||
| 233 | + } | ||
| 234 | + break; | ||
| 235 | + case CNLiveUserInfoDataTypeAddress://地区 | ||
| 236 | + { | ||
| 237 | + [self requestUpdateUserAddress]; | ||
| 238 | + } | ||
| 239 | + break; | ||
| 240 | + case CNLiveUserInfoDataTypeIntroduction://简介 | ||
| 241 | + { | ||
| 242 | + [self requestUpdateUserIntroduction]; | ||
| 243 | + } | ||
| 244 | + break; | ||
| 245 | + | ||
| 246 | + default: | ||
| 247 | + break; | ||
| 248 | + } | ||
| 249 | + } | ||
| 171 | } | 250 | } |
| 172 | -#pragma mark - UITextViewDelegate | ||
| 173 | -- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{ | ||
| 174 | - self.navigationBar.right.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0]; | 251 | + |
| 252 | +- (void)didHideAlertController:(QMUIAlertController *)alertController{ | ||
| 175 | self.navigationBar.right.userInteractionEnabled = YES; | 253 | self.navigationBar.right.userInteractionEnabled = YES; |
| 176 | - return YES; | ||
| 177 | -} | ||
| 178 | -- (BOOL)textViewShouldEndEditing:(UITextView *)textView{ | ||
| 179 | - return YES; | ||
| 180 | -} | ||
| 181 | -- (void)textViewDidBeginEditing:(UITextView *)textView{ | ||
| 182 | - | ||
| 183 | -} | ||
| 184 | -- (void)textViewDidEndEditing:(UITextView *)textView{ | ||
| 185 | - | ||
| 186 | -} | ||
| 187 | -- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ | ||
| 188 | - return YES; | ||
| 189 | - | ||
| 190 | -} | ||
| 191 | -- (void)textViewDidChange:(UITextView *)textView{ | ||
| 192 | - | 254 | + |
| 193 | } | 255 | } |
| 194 | -#pragma mark - 私有方法 | 256 | + |
| 257 | +#pragma mark - 更新头像 | ||
| 195 | // 修改头像 | 258 | // 修改头像 |
| 196 | - (void)updateHeaderActionSheetView{ | 259 | - (void)updateHeaderActionSheetView{ |
| 197 | __weak typeof(self) weakSelf = self; | 260 | __weak typeof(self) weakSelf = self; |
| 198 | QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"拍照" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | 261 | QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"拍照" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { |
| 199 | __strong typeof(weakSelf) strongSelf = weakSelf; | 262 | __strong typeof(weakSelf) strongSelf = weakSelf; |
| 200 | if(!strongSelf) return ; | 263 | if(!strongSelf) return ; |
| 201 | - | 264 | + XFCameraController *cameraController = [[XFCameraController alloc] init]; |
| 265 | + cameraController.isCanShootVideo = NO; | ||
| 266 | + cameraController.modalPresentationStyle = UIModalPresentationFullScreen; | ||
| 267 | + __weak XFCameraController *weakCameraController = cameraController; | ||
| 268 | + __weak typeof(self) weakSelf = self; | ||
| 269 | + cameraController.takePhotosCompletionBlock = ^(UIImage *image, NSError *error) { | ||
| 270 | + __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 271 | + if(!strongSelf) return ; | ||
| 272 | + strongSelf->_image = image; | ||
| 273 | + [strongSelf requestUpdateUserHeader:image]; | ||
| 274 | + dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 275 | + [weakCameraController dismissViewControllerAnimated:YES completion:nil]; | ||
| 276 | + }); | ||
| 277 | + }; | ||
| 278 | + [self presentViewController:cameraController animated:YES completion:nil]; | ||
| 202 | self.navigationBar.right.userInteractionEnabled = YES; | 279 | self.navigationBar.right.userInteractionEnabled = YES; |
| 203 | }]; | 280 | }]; |
| 204 | QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"从手机相册中选择" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | 281 | QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"从手机相册中选择" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { |
| 205 | __strong typeof(weakSelf) strongSelf = weakSelf; | 282 | __strong typeof(weakSelf) strongSelf = weakSelf; |
| 206 | if(!strongSelf) return ; | 283 | if(!strongSelf) return ; |
| 207 | - self.navigationBar.right.userInteractionEnabled = YES; | 284 | + strongSelf.navigationBar.right.userInteractionEnabled = YES; |
| 285 | + TZImagePickerController *picker = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:strongSelf]; | ||
| 286 | + picker.modalPresentationStyle = UIModalPresentationFullScreen; | ||
| 287 | + picker.allowPickingVideo = NO; | ||
| 288 | + picker.allowPreview = NO; | ||
| 289 | + __weak typeof(self) weakSelf = self; | ||
| 290 | + [picker setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | ||
| 291 | + __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 292 | + if(!strongSelf) return ; | ||
| 293 | + strongSelf->_image = [photos firstObject]; | ||
| 294 | + [strongSelf requestUpdateUserHeader:[photos firstObject]]; | ||
| 295 | + }]; | ||
| 296 | + [self presentViewController:picker animated:YES completion:nil]; | ||
| 208 | 297 | ||
| 209 | }]; | 298 | }]; |
| 210 | QMUIAlertAction *action3 = [QMUIAlertAction actionWithTitle:@"保存图片" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | 299 | QMUIAlertAction *action3 = [QMUIAlertAction actionWithTitle:@"保存图片" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { |
| @@ -250,7 +339,29 @@ static const CGFloat timeValue = 1.5; | @@ -250,7 +339,29 @@ static const CGFloat timeValue = 1.5; | ||
| 250 | 339 | ||
| 251 | // 更新头像 | 340 | // 更新头像 |
| 252 | - (void)requestUpdateUserHeader:(UIImage *)image{ | 341 | - (void)requestUpdateUserHeader:(UIImage *)image{ |
| 253 | - // 数据请求更新 | 342 | + [QMUITips showLoading:@"修改中" inView:self.view]; |
| 343 | + [CNLiveUserSystemCenter uploadIconWithUid:CNUserShareModel.uid icon:image compressionQuality:0.99 success:^(id result) { | ||
| 344 | +// [[IMAPlatform sharedInstance].host asyncProfile]; | ||
| 345 | + [QMUITips hideAllToastInView:self.view animated:YES]; | ||
| 346 | + CNUserShareModel.faceUrl = result[@"data"][@"faceUrl"]; | ||
| 347 | + CNUserShareModel.bigFaceUrl = result[@"data"][@"bigFaceUrl"]; | ||
| 348 | + | ||
| 349 | + [self.imageView sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.bigFaceUrl] placeholderImage:self->_image completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { | ||
| 350 | + self.imageView.image = image; | ||
| 351 | + [QMUITips showSucceed:@"修改成功" inView:self.view hideAfterDelay:timeValue]; | ||
| 352 | + //增加积分 | ||
| 353 | + [CNLiveAddScoreManager requestTaskId:@"update_face" contentId:@"" block:^(BOOL isSuccess, NSString *desc, NSString * _Nonnull score) { | ||
| 354 | + if(isSuccess){ | ||
| 355 | + [CNLiveGoldWhereaboutsView showWithDesc:desc score:score]; | ||
| 356 | + | ||
| 357 | + } | ||
| 358 | + }]; | ||
| 359 | + }]; | ||
| 360 | + | ||
| 361 | + } failure:^(NSDictionary *errorDic) { | ||
| 362 | + [self showError:errorDic[@"errorMessage"]]; | ||
| 363 | + | ||
| 364 | + }]; | ||
| 254 | 365 | ||
| 255 | } | 366 | } |
| 256 | - (void)getPHAuthorizationStatus:(void (^)(void))block{ | 367 | - (void)getPHAuthorizationStatus:(void (^)(void))block{ |
| @@ -323,92 +434,112 @@ static const CGFloat timeValue = 1.5; | @@ -323,92 +434,112 @@ static const CGFloat timeValue = 1.5; | ||
| 323 | return newImage; | 434 | return newImage; |
| 324 | } | 435 | } |
| 325 | 436 | ||
| 326 | -- (void)requestUpdateUserInfo:(NSString *)info{ | ||
| 327 | - // 数据请求更新 | 437 | +#pragma mark - 更新昵称 |
| 438 | +- (void)requestUpdateUserNickname{ | ||
| 439 | + NSString *text = [self.textField.text trim]; | ||
| 440 | + if (text.length == 0) { | ||
| 441 | + [QMUITips showError:@"没有输入名字,请重新填写" inView:self.view hideAfterDelay:timeValue]; | ||
| 442 | + self.navigationBar.right.userInteractionEnabled = YES; | ||
| 443 | + return; | ||
| 444 | + } | ||
| 445 | + if ([text isEqualToString:CNUserShareModel.nickname]) { | ||
| 446 | + self.navigationBar.right.userInteractionEnabled = YES; | ||
| 447 | + [self goBack]; | ||
| 448 | + return; | ||
| 449 | + } | ||
| 450 | + | ||
| 451 | + [QMUITips showLoading:@"修改中" inView:self.view]; | ||
| 452 | + [CNLiveUserSystemCenter modifyUserInfoType:UserInfoTypeNickName uid:CNUserShareModel.uid modifyInfo:text success:^(id result) { | ||
| 453 | +// [[IMAPlatform sharedInstance].host asyncProfile]; | ||
| 454 | + CNUserShareModel.nickname = self.textField.text; | ||
| 455 | + [self showSucceed:@"修改成功"]; | ||
| 456 | + | ||
| 457 | + //增加积分 | ||
| 458 | + [CNLiveAddScoreManager requestTaskId:@"update_nick" contentId:@"" block:^(BOOL isSuccess, NSString *desc, NSString * _Nonnull score) { | ||
| 459 | + if(isSuccess){ | ||
| 460 | + [CNLiveGoldWhereaboutsView showWithDesc:desc score:score]; | ||
| 461 | + } | ||
| 462 | + }]; | ||
| 463 | + | ||
| 464 | + } failure:^(NSDictionary *errorDic) { | ||
| 465 | + [self showError:errorDic[@"errorMessage"]]; | ||
| 466 | + | ||
| 467 | + }]; | ||
| 328 | 468 | ||
| 329 | } | 469 | } |
| 330 | 470 | ||
| 331 | -- (void)updateDataType:(CNLiveUserInfoDataType)dataType info:(NSString *)info{ | ||
| 332 | - // 1.数据请求成功后更新cell展示信息 | ||
| 333 | - if (self.delegate && [self.delegate respondsToSelector:@selector(updateSuccess:info:)]) { | ||
| 334 | - [self.delegate updateSuccess:dataType info:info]; | 471 | +#pragma mark - 更新地区 |
| 472 | +- (void)requestUpdateUserAddress{ | ||
| 473 | + NSString *text = [self.textField.text trim]; | ||
| 474 | + if (text.length == 0) { | ||
| 475 | + [QMUITips showError:@"请填写您的位置" inView:self.view hideAfterDelay:timeValue]; | ||
| 476 | + self.navigationBar.right.userInteractionEnabled = YES; | ||
| 477 | + return; | ||
| 478 | + } | ||
| 479 | + if ([text isEqualToString:CNUserShareModel.location]) { | ||
| 480 | + self.navigationBar.right.userInteractionEnabled = YES; | ||
| 481 | + [self goBack]; | ||
| 482 | + return; | ||
| 335 | } | 483 | } |
| 336 | 484 | ||
| 337 | - // 2.数据请求成功后通知用户信息更新 | ||
| 338 | - [CNLiveUserInfoNotification postUserInfoUpdateNotificationType:dataType info:info]; | ||
| 339 | - | ||
| 340 | - // 3.数据请求成功后修改用户模型 | ||
| 341 | -// switch (dataType) { | ||
| 342 | -// case CNLiveUserInfoDataTypeNickname://昵称 | ||
| 343 | -// { | ||
| 344 | -// [CNLiveUserManager updateUserInfo:CNLiveUserInfoTypeName info:info]; | ||
| 345 | -// } | ||
| 346 | -// break; | ||
| 347 | -// case CNLiveUserInfoDataTypeAddress://地区 | ||
| 348 | -// { | ||
| 349 | -// [CNLiveUserManager updateUserInfo:CNLiveUserInfoTypeAddress info:info]; | ||
| 350 | -// } | ||
| 351 | -// break; | ||
| 352 | -// case CNLiveUserInfoDataTypeIntroduction://简介 | ||
| 353 | -// { | ||
| 354 | -// [CNLiveUserManager updateUserInfo:CNLiveUserInfoTypeIntroduction info:info]; | ||
| 355 | -// | ||
| 356 | -// } | ||
| 357 | -// break; | ||
| 358 | -// | ||
| 359 | -// default: | ||
| 360 | -// break; | ||
| 361 | -// } | 485 | + [QMUITips showLoading:@"修改中" inView:self.view]; |
| 486 | + [CNLiveUserSystemCenter modifyUserInfoType:UserInfoTypeLocation uid:CNUserShareModel.uid modifyInfo:text success:^(id result) { | ||
| 487 | + CNUserShareModel.location = self.textField.text; | ||
| 488 | + [self showSucceed:@"修改成功"]; | ||
| 489 | + | ||
| 490 | + } failure:^(NSDictionary *errorDic) { | ||
| 491 | + [self showError:errorDic[@"errorMessage"]]; | ||
| 492 | + | ||
| 493 | + }]; | ||
| 362 | 494 | ||
| 363 | } | 495 | } |
| 364 | 496 | ||
| 365 | -#pragma mark - 响应方法 | ||
| 366 | -//回退goBack | ||
| 367 | -- (void)goBack { | ||
| 368 | - if (self.presentingViewController != nil) { | ||
| 369 | - [self dismissViewControllerAnimated:YES completion:nil]; | 497 | +#pragma mark - 更新个性签名 |
| 498 | +- (void)requestUpdateUserIntroduction { | ||
| 499 | + BOOL isNil = [[self.textView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]length] == 0; | ||
| 500 | + | ||
| 501 | + if ([self.textView.text isEqualToString:CNUserShareModel.signature]) { | ||
| 502 | + self.navigationBar.right.userInteractionEnabled = YES; | ||
| 503 | + [self goBack]; | ||
| 370 | } | 504 | } |
| 371 | - else { | ||
| 372 | - [self.navigationController popViewControllerAnimated:YES]; | 505 | + |
| 506 | + // 签名不可以为空 | ||
| 507 | + NSString *signature; | ||
| 508 | + if (isNil) { | ||
| 509 | + signature = @""; | ||
| 510 | + } else { | ||
| 511 | + signature = [self.textView.text qmui_trim]; | ||
| 373 | } | 512 | } |
| 374 | -} | ||
| 375 | -- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { | ||
| 376 | - [self.view endEditing:YES]; | 513 | + |
| 514 | + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:signature,@"userSign", nil]; | ||
| 515 | + NSString *updateSign = CNLiveNSDictionaryDicToJson(dic); | ||
| 516 | + | ||
| 517 | + [QMUITips showLoading:@"修改中" inView:self.view]; | ||
| 518 | + [CNLiveUserSystemCenter updateOtherInfoWithUid:CNUserShareModel.uid extInfo:updateSign success:^(id result) { | ||
| 519 | + CNUserShareModel.signature = signature; | ||
| 520 | + [self showSucceed:@"修改成功"]; | ||
| 521 | + | ||
| 522 | + } failure:^(NSDictionary *errorDic) { | ||
| 523 | + [self showError:errorDic[@"errorMessage"]]; | ||
| 524 | + | ||
| 525 | + }]; | ||
| 526 | + | ||
| 377 | } | 527 | } |
| 378 | 528 | ||
| 379 | -#pragma mark - CNLiveUserInfoNavigationBarDelegate | ||
| 380 | -- (void)navigationBar:(CNLiveUserInfoNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | ||
| 381 | - if ([actionEvents isEqualToString:@"1"]) { | 529 | +#pragma mark - 更新提示 |
| 530 | +- (void)showSucceed:(NSString *)text{ | ||
| 531 | + [QMUITips hideAllToastInView:self.view animated:YES]; | ||
| 532 | + self.navigationBar.right.userInteractionEnabled = YES; | ||
| 533 | + [QMUITips showSucceed:text inView:self.view]; | ||
| 534 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeValue * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 535 | + [QMUITips hideAllToastInView:self.view animated:YES]; | ||
| 382 | [self goBack]; | 536 | [self goBack]; |
| 383 | - }else if ([actionEvents isEqualToString:@"2"]){ | ||
| 384 | - switch (self.model.dataType) { | ||
| 385 | - case CNLiveUserInfoDataTypeHead://头像 | ||
| 386 | - { | ||
| 387 | - self.navigationBar.right.userInteractionEnabled = NO; | ||
| 388 | - [self updateHeaderActionSheetView]; | ||
| 389 | - } | ||
| 390 | - break; | ||
| 391 | - case CNLiveUserInfoDataTypeNickname://昵称 | ||
| 392 | - case CNLiveUserInfoDataTypeAddress://地区 | ||
| 393 | - { | ||
| 394 | - [self requestUpdateUserInfo:self.textField.text]; | ||
| 395 | - } | ||
| 396 | - break; | ||
| 397 | - case CNLiveUserInfoDataTypeIntroduction://简介 | ||
| 398 | - { | ||
| 399 | - [self requestUpdateUserInfo:self.textView.text]; | ||
| 400 | - } | ||
| 401 | - break; | ||
| 402 | - | ||
| 403 | - default: | ||
| 404 | - break; | ||
| 405 | - } | ||
| 406 | - } | 537 | + }); |
| 407 | } | 538 | } |
| 408 | - | ||
| 409 | -- (void)didHideAlertController:(QMUIAlertController *)alertController{ | 539 | +- (void)showError:(NSString *)text{ |
| 410 | self.navigationBar.right.userInteractionEnabled = YES; | 540 | self.navigationBar.right.userInteractionEnabled = YES; |
| 411 | - | 541 | + [QMUITips hideAllToastInView:self.view animated:YES]; |
| 542 | + [QMUITips showError:text inView:self.view hideAfterDelay:timeValue]; | ||
| 412 | } | 543 | } |
| 413 | 544 | ||
| 414 | #pragma mark - 懒加载 | 545 | #pragma mark - 懒加载 |
| @@ -444,6 +575,133 @@ static const CGFloat timeValue = 1.5; | @@ -444,6 +575,133 @@ static const CGFloat timeValue = 1.5; | ||
| 444 | return _navigationBar; | 575 | return _navigationBar; |
| 445 | } | 576 | } |
| 446 | 577 | ||
| 578 | +- (UIView *)contentView{ | ||
| 579 | + if(!_contentView){ | ||
| 580 | + _contentView = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 50)]; | ||
| 581 | + _contentView.backgroundColor = [UIColor whiteColor]; | ||
| 582 | + switch (self.model.dataType) { | ||
| 583 | + case CNLiveUserInfoDataTypeHead: | ||
| 584 | + { | ||
| 585 | + self.view.backgroundColor = [UIColor blackColor]; | ||
| 586 | + _contentView.backgroundColor = [UIColor blackColor]; | ||
| 587 | + | ||
| 588 | + self.navigationBar.title.text = @"个人头像"; | ||
| 589 | + [self.view addSubview:self.imageView]; | ||
| 590 | + | ||
| 591 | + } | ||
| 592 | + break; | ||
| 593 | + case CNLiveUserInfoDataTypeNickname: | ||
| 594 | + { | ||
| 595 | + self.navigationBar.title.text = @"设置昵称"; | ||
| 596 | + | ||
| 597 | + [_contentView addSubview:self.textField]; | ||
| 598 | + self.textField.placeholder = @"请输入昵称"; | ||
| 599 | + | ||
| 600 | + self.textField.text = self.model.content; | ||
| 601 | + } | ||
| 602 | + break; | ||
| 603 | + case CNLiveUserInfoDataTypeAddress: | ||
| 604 | + { | ||
| 605 | + self.navigationBar.title.text = @"设置地区"; | ||
| 606 | + | ||
| 607 | + [_contentView addSubview:self.textField]; | ||
| 608 | + self.textField.placeholder = @"请输入你所在的地区"; | ||
| 609 | + | ||
| 610 | + self.textField.text = self.model.content; | ||
| 611 | + } | ||
| 612 | + break; | ||
| 613 | + case CNLiveUserInfoDataTypeIntroduction: | ||
| 614 | + { | ||
| 615 | + self.navigationBar.title.text = @"设置个性签名"; | ||
| 616 | + | ||
| 617 | + _contentView.frame = CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 120); | ||
| 618 | + [_contentView addSubview:self.textView]; | ||
| 619 | + self.textView.text = self.model.content; | ||
| 620 | + self.textNum.text = [NSString stringWithFormat:@"%ld",MAX(0,MAX_LIMIT_NUMS - self.textView.text.length)]; | ||
| 621 | + | ||
| 622 | + [_contentView addSubview:self.textNum]; | ||
| 623 | + [self.textNum mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 624 | + make.right.equalTo(self.textView); | ||
| 625 | + make.bottom.equalTo(self.textView).offset(-margin); | ||
| 626 | + }]; | ||
| 627 | + } | ||
| 628 | + break; | ||
| 629 | + default: | ||
| 630 | + { | ||
| 631 | + | ||
| 632 | + } | ||
| 633 | + break; | ||
| 634 | + } | ||
| 635 | + | ||
| 636 | + } | ||
| 637 | + return _contentView; | ||
| 638 | + | ||
| 639 | +} | ||
| 640 | + | ||
| 641 | +- (UIImageView *)imageView{ | ||
| 642 | + if(!_imageView){ | ||
| 643 | + _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH)]; | ||
| 644 | + _imageView.center = self.view.center; | ||
| 645 | + UIImage *xw_image = [self xw_getImageName:@"default_avatar_f" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; | ||
| 646 | + [_imageView sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.bigFaceUrl?CNUserShareModel.bigFaceUrl:CNUserShareModel.faceUrl] placeholderImage:xw_image]; | ||
| 647 | + } | ||
| 648 | + return _imageView; | ||
| 649 | +} | ||
| 650 | + | ||
| 651 | +- (UITextField *)textField{ | ||
| 652 | + if(!_textField){ | ||
| 653 | + _textField = [[UITextField alloc] initWithFrame:CGRectMake(margin, 0, SCREEN_WIDTH-2*margin, 50)]; | ||
| 654 | + _textField.delegate = self; | ||
| 655 | + _textField.backgroundColor = [UIColor whiteColor];// 设置背景颜色 | ||
| 656 | + _textField.textColor = [UIColor blackColor]; // 设置文字的颜色 | ||
| 657 | + _textField.clearsOnBeginEditing = YES; // 当第二次输入的时候,清空上一次的内容 | ||
| 658 | + _textField.font = [UIFont systemFontOfSize:15.0f]; | ||
| 659 | + _textField.clearButtonMode = UITextFieldViewModeWhileEditing; // 编辑的时候会显示出删除全部的小X | ||
| 660 | + _textField.clearButtonMode = UITextFieldViewModeAlways; | ||
| 661 | + _textField.backgroundColor = [UIColor whiteColor]; | ||
| 662 | + //设置显示模式为永远显示(默认不显示) | ||
| 663 | + _textField.leftViewMode = UITextFieldViewModeAlways; | ||
| 664 | + _textField.returnKeyType = UIReturnKeyDone; | ||
| 665 | + _textField.delegate = self; | ||
| 666 | + [_textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; | ||
| 667 | + } | ||
| 668 | + return _textField; | ||
| 669 | +} | ||
| 670 | + | ||
| 671 | +- (UITextView *)textView{ | ||
| 672 | + if(!_textView){ | ||
| 673 | + _textView = [[UITextView alloc] initWithFrame:CGRectMake(margin, 0, SCREEN_WIDTH-2*margin, 120)]; | ||
| 674 | + _textView.delegate = self; | ||
| 675 | + _textView.backgroundColor = [UIColor whiteColor];// 设置背景颜色 | ||
| 676 | + _textView.textColor = [UIColor blackColor]; // 设置文字的颜色 | ||
| 677 | + _textView.font = [UIFont systemFontOfSize:16.0f]; | ||
| 678 | + } | ||
| 679 | + return _textView; | ||
| 680 | +} | ||
| 681 | + | ||
| 682 | +- (UILabel *)textNum { | ||
| 683 | + if (!_textNum) { | ||
| 684 | + _textNum = [[UILabel alloc] init]; | ||
| 685 | + _textNum.textColor = [UIColor colorWithRed:206/255.0 green:206/255.0 blue:206/255.0 alpha:1.0]; | ||
| 686 | + _textNum.font = [UIFont systemFontOfSize:16]; | ||
| 687 | + _textNum.text = @"30"; | ||
| 688 | + } | ||
| 689 | + return _textNum; | ||
| 690 | +} | ||
| 691 | + | ||
| 692 | +#pragma mark - 响应方法 | ||
| 693 | +- (void)goBack { | ||
| 694 | + [self.textField resignFirstResponder]; | ||
| 695 | + [self.textView resignFirstResponder]; | ||
| 696 | + | ||
| 697 | + if (self.presentingViewController != nil) { | ||
| 698 | + [self dismissViewControllerAnimated:YES completion:nil]; | ||
| 699 | + } | ||
| 700 | + else { | ||
| 701 | + [self.navigationController popViewControllerAnimated:YES]; | ||
| 702 | + } | ||
| 703 | +} | ||
| 704 | + | ||
| 447 | /** | 705 | /** |
| 448 | * 创建图片 | 706 | * 创建图片 |
| 449 | * | 707 | * |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoCell.m
| @@ -63,9 +63,9 @@ static const NSInteger margin = 12; | @@ -63,9 +63,9 @@ static const NSInteger margin = 12; | ||
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | }else if (model.dataType == CNLiveUserInfoDataTypeGender){ | 65 | }else if (model.dataType == CNLiveUserInfoDataTypeGender){ |
| 66 | - if([model.content isEqualToString:@"0"]){ | 66 | + if([model.content isEqualToString:@"m"]){ |
| 67 | _content.text = @"男"; | 67 | _content.text = @"男"; |
| 68 | - }else if([model.content isEqualToString:@"1"]){ | 68 | + }else if([model.content isEqualToString:@"f"]){ |
| 69 | _content.text = @"女"; | 69 | _content.text = @"女"; |
| 70 | }else{ | 70 | }else{ |
| 71 | _content.text = @"未知"; | 71 | _content.text = @"未知"; |
| @@ -189,6 +189,7 @@ static const NSInteger margin = 12; | @@ -189,6 +189,7 @@ static const NSInteger margin = 12; | ||
| 189 | _content.lineBreakMode = NSLineBreakByTruncatingTail; | 189 | _content.lineBreakMode = NSLineBreakByTruncatingTail; |
| 190 | _content.textColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0]; | 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]; | 191 | _content.font = [UIFont systemFontOfSize:14]; |
| 192 | + _content.textAlignment = NSTextAlignmentRight; | ||
| 192 | } | 193 | } |
| 193 | return _content; | 194 | return _content; |
| 194 | } | 195 | } |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoController.m
| @@ -76,7 +76,7 @@ | @@ -76,7 +76,7 @@ | ||
| 76 | @"layout":@"1", | 76 | @"layout":@"1", |
| 77 | @"data":@"5", | 77 | @"data":@"5", |
| 78 | @"title":@"个性签名", | 78 | @"title":@"个性签名", |
| 79 | - @"content":CNUserShareModel.signature?CNUserShareModel.signature:@"懒到没签名!!!", | 79 | + @"content":CNUserShareModel.signature?CNUserShareModel.signature:@"懒到没签名!", |
| 80 | @"height":@"51", | 80 | @"height":@"51", |
| 81 | @"lineHeight":@"0.5" | 81 | @"lineHeight":@"0.5" |
| 82 | } | 82 | } |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoNavigationBar.m
| @@ -98,6 +98,7 @@ static const NSInteger margin = 15; | @@ -98,6 +98,7 @@ static const NSInteger margin = 15; | ||
| 98 | } | 98 | } |
| 99 | - (void)rightDidClicked:(UIButton *)btn{ | 99 | - (void)rightDidClicked:(UIButton *)btn{ |
| 100 | if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) { | 100 | if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) { |
| 101 | + self.right.userInteractionEnabled = NO; | ||
| 101 | [self.delegate navigationBar:self actionEvents:@"2"]; | 102 | [self.delegate navigationBar:self actionEvents:@"2"]; |
| 102 | } | 103 | } |
| 103 | } | 104 | } |
Example/CNLiveMineModule.xcodeproj/project.pbxproj
| @@ -334,6 +334,7 @@ | @@ -334,6 +334,7 @@ | ||
| 334 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework", | 334 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework", |
| 335 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", | 335 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", |
| 336 | "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework", | 336 | "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework", |
| 337 | + "${BUILT_PRODUCTS_DIR}/CNLiveChooseCountry/CNLiveChooseCountry.framework", | ||
| 337 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework", | 338 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework", |
| 338 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework", | 339 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework", |
| 339 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", | 340 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", |
| @@ -366,6 +367,7 @@ | @@ -366,6 +367,7 @@ | ||
| 366 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework", | 367 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework", |
| 367 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", | 368 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", |
| 368 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework", | 369 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework", |
| 370 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveChooseCountry.framework", | ||
| 369 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework", | 371 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework", |
| 370 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework", | 372 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework", |
| 371 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", | 373 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", |
Example/CNLiveMineModule/CNLIVEAppDelegate.m
| @@ -8,7 +8,6 @@ | @@ -8,7 +8,6 @@ | ||
| 8 | 8 | ||
| 9 | #import "CNLIVEAppDelegate.h" | 9 | #import "CNLIVEAppDelegate.h" |
| 10 | #import "CNLiveMineController.h" | 10 | #import "CNLiveMineController.h" |
| 11 | -#import "CNLiveGoldWhereaboutsView.h" | ||
| 12 | #import "CNUserInfoManager.h" | 11 | #import "CNUserInfoManager.h" |
| 13 | 12 | ||
| 14 | @implementation CNLIVEAppDelegate | 13 | @implementation CNLIVEAppDelegate |