PersonalInfoController.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. //
  2. // PersonalInfoController.m
  3. // AIIM
  4. //
  5. // Created by qitewei on 2025/4/29.
  6. //
  7. #import "PersonalInfoController.h"
  8. #import "UDManager.h"
  9. #import "UserNetApi.h"
  10. #import "GroupNetApi.h"
  11. @interface PersonalInfoController ()<UITextFieldDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate>
  12. @property (nonatomic, strong) UIImageView * avatarImageView;
  13. @property (nonatomic, strong) UIButton * avaterEditBtn;
  14. @property (nonatomic, strong) UIStackView * titleStackView;
  15. @property (nonatomic, strong) UILabel * nameLbl;
  16. @property (nonatomic, strong) UILabel * signLbl;
  17. @property (nonatomic, strong) UILabel * emailLbl;
  18. @property (nonatomic, strong) UILabel * mobileLbl;
  19. @property (nonatomic, strong) UILabel * genderLbl;
  20. @property (nonatomic, strong) UITextField * nameTextfield;//用户名
  21. @property (nonatomic, strong) UITextField * signTextfield;//昵称
  22. @property (nonatomic, strong) UITextField * emailTextfield;
  23. @property (nonatomic, strong) UITextField * mobileTextfield;
  24. @property (nonatomic, strong) UITextField * genderTextfield;
  25. @property (nonatomic, strong) UIButton * saveBtn;
  26. @property (nonatomic, strong) NSMutableDictionary * userInfo;
  27. @end
  28. @implementation PersonalInfoController
  29. #pragma mark lifecircle
  30. - (void)viewDidLoad {
  31. [super viewDidLoad];
  32. // 创建一个点击手势
  33. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard)];
  34. // 将手势添加到主视图上
  35. [self.view addGestureRecognizer:tap];
  36. [self configUI];
  37. }
  38. -(void)dismissKeyboard{
  39. NSLog(@"dismissKeyboard");
  40. [self.view endEditing:YES];
  41. }
  42. #pragma mark UI
  43. - (void)configUI{
  44. [self setNavigationBarHidden:NO animated:YES];
  45. [self setNavigationTitle:NSLocalizedString(@"userCenter-gerenxinx", @"")];
  46. // 设置导航栏背景色
  47. [self setNavigationBarTransparent:YES];
  48. [self setNavigationBarBackgroundColor:UIColor.clearColor];
  49. // 设置标题颜色和字体
  50. [self setNavigationTitleColor:[UIColor whiteColor] font:[UIFont boldSystemFontOfSize:16]];
  51. // 设置返回按钮
  52. [self setBackButtonTitle:@""];
  53. [self setBackButtonColor:[UIColor whiteColor]];
  54. self.view.backgroundColor = UIColor.blackColor;
  55. UIImageView * bgImageView = [[UIImageView alloc] initWithImage:kImageMake(@"loginBG")];
  56. [self.view addSubview:bgImageView];
  57. [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  58. make.left.right.top.bottom.mas_equalTo(0);
  59. }];
  60. [self.view addSubview:self.avatarImageView];
  61. [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.size.mas_equalTo(CGSizeMake(88, 88 ));
  63. make.top.mas_equalTo(120);
  64. make.centerX.mas_equalTo(self.view.mas_centerX);
  65. }];
  66. [self.view addSubview:self.avaterEditBtn];
  67. [self.avaterEditBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  68. make.size.mas_equalTo(CGSizeMake(28, 28));
  69. make.bottom.mas_equalTo(self.avatarImageView.mas_bottom);
  70. make.right.mas_equalTo(self.avatarImageView.mas_right);
  71. }];
  72. [self.view addSubview:self.titleStackView];
  73. [self.titleStackView mas_makeConstraints:^(MASConstraintMaker *make) {
  74. make.height.mas_equalTo(310);
  75. make.left.mas_equalTo(20);
  76. make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(38);
  77. make.width.mas_equalTo(64);
  78. }];
  79. [self.view addSubview:self.nameTextfield];
  80. [self.nameTextfield mas_makeConstraints:^(MASConstraintMaker *make) {
  81. make.left.mas_equalTo(self.titleStackView.mas_right).offset(20);
  82. make.height.mas_equalTo(50);
  83. make.right.mas_equalTo(-20);
  84. make.centerY.mas_equalTo(self.nameLbl.mas_centerY);
  85. }];
  86. [self.view addSubview:self.signTextfield];
  87. [self.signTextfield mas_makeConstraints:^(MASConstraintMaker *make) {
  88. make.left.mas_equalTo(self.titleStackView.mas_right).offset(20);
  89. make.height.mas_equalTo(50);
  90. make.right.mas_equalTo(-20);
  91. make.centerY.mas_equalTo(self.signLbl.mas_centerY);
  92. }];
  93. [self.view addSubview:self.emailTextfield];
  94. [self.emailTextfield mas_makeConstraints:^(MASConstraintMaker *make) {
  95. make.left.mas_equalTo(self.titleStackView.mas_right).offset(20);
  96. make.height.mas_equalTo(50);
  97. make.right.mas_equalTo(-20);
  98. make.centerY.mas_equalTo(self.emailLbl.mas_centerY);
  99. }];
  100. [self.view addSubview:self.mobileTextfield];
  101. [self.mobileTextfield mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.left.mas_equalTo(self.titleStackView.mas_right).offset(20);
  103. make.height.mas_equalTo(50);
  104. make.right.mas_equalTo(-20);
  105. make.centerY.mas_equalTo(self.mobileLbl.mas_centerY);
  106. }];
  107. [self.view addSubview:self.genderTextfield];
  108. [self.genderTextfield mas_makeConstraints:^(MASConstraintMaker *make) {
  109. make.left.mas_equalTo(self.titleStackView.mas_right).offset(20);
  110. make.height.mas_equalTo(50);
  111. make.right.mas_equalTo(-20);
  112. make.centerY.mas_equalTo(self.genderLbl.mas_centerY);
  113. }];
  114. [self.view addSubview:self.saveBtn];
  115. [self.saveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  116. make.height.mas_equalTo(46);
  117. make.left.mas_equalTo(20);
  118. make.right.mas_equalTo(-20);
  119. make.top.mas_equalTo(self.genderTextfield.mas_bottom).offset(30);
  120. }];
  121. [self.avatarImageView sd_setImageWithURL:getURL(self.userInfo[@"avatar"]) placeholderImage:kImageMake(@"Avatar")];
  122. self.nameTextfield.text = self.userInfo[@"username"];
  123. self.signTextfield.text = self.userInfo[@"name"];
  124. self.emailTextfield.text = self.userInfo[@"email"];
  125. self.mobileTextfield.text = self.userInfo[@"mobile"];
  126. self.genderTextfield.text = [self.userInfo[@"sex"] isEqualToString:@"0"] ? @"男": @"女";
  127. _genderLbl.alpha = 0;
  128. _genderTextfield.alpha = 0;
  129. }
  130. -(BOOL)isValidEmail:(NSString *)email {
  131. if(email.length==0){
  132. return true;
  133. }
  134. NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}";
  135. NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
  136. return [emailTest evaluateWithObject:email];
  137. }
  138. #pragma mark event
  139. - (void)saveButtonClicked{
  140. if (self.mobileTextfield.text.length<5&&self.mobileTextfield.text.length>0) {
  141. [MBProgressHUD showWithText:@"请输入有效的手机号"];
  142. return;
  143. }
  144. if (![self isValidEmail:self.emailTextfield.text]) {
  145. [MBProgressHUD showWithText:@"请输入有效的邮箱"];
  146. return;
  147. }
  148. NSDictionary * param = @{
  149. @"id":self.userInfo[@"id"],
  150. @"name":self.signTextfield.text.length == 0 ? @"" : self.signTextfield.text,
  151. @"email":self.emailTextfield.text,
  152. @"mobile":self.mobileTextfield.text.length == 0 ? @"" : self.mobileTextfield.text,
  153. @"sex":[self.genderTextfield.text isEqualToString:@"男"]?@"0" :@"1",
  154. @"avatar":self.userInfo[@"avatar"]
  155. };
  156. [UserNetApi changeUserInfo:param succ:^(int code, NSDictionary * _Nullable res) {
  157. if ([res jk_hasKey:@"msg"]) {
  158. [MBProgressHUD showWithText:[res objectForKey:@"msg"]];
  159. }
  160. if ([res jk_hasKey:@"code"]) {
  161. NSNumber * resCode = res[@"code"];
  162. if ([resCode integerValue] == 200) {
  163. NSDictionary *ps = @{@"avatar": self.userInfo[@"avatar"]?:@"",
  164. @"deptId": self.userInfo[@"deptId"]?:@"",
  165. @"email":self.emailTextfield.text?:@"",
  166. @"id":self.userInfo[@"id"]?:@"",
  167. @"mobile":self.mobileTextfield.text?:@"",
  168. @"name":self.signTextfield.text?:@"",
  169. @"sex":[self.genderTextfield.text isEqualToString:@"男"]?@"0":@"1",
  170. @"username":self.userInfo[@"username"]?:@"",
  171. };
  172. [UDManager.shareInstance setDDManager:ps key:dkuserinfo];
  173. !self->_infoRefreshBlock ?: self->_infoRefreshBlock();
  174. }
  175. }
  176. } fail:^(NSError * _Nonnull error) {
  177. [MBProgressHUD showWithText:@"修改失败"];
  178. }];
  179. }
  180. - (void)avatarEditButtonClicked{
  181. [self openImagePicker];
  182. }
  183. #pragma mark textfield delegate
  184. - (void)textFieldDidEndEditing:(UITextField *)textField{
  185. textField.layer.borderColor = UIColor.lightGrayColor.CGColor;
  186. }
  187. - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
  188. textField.layer.borderColor = globalColor(GCTypeGreen).CGColor;
  189. textField.textColor = UIColor.whiteColor;
  190. if (textField == self.genderTextfield) {
  191. //性别弹窗
  192. [self showGenderSelectionAlert];
  193. return NO;
  194. }
  195. return YES;
  196. }
  197. - (void)showGenderSelectionAlert {
  198. // 创建 UIAlertController
  199. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"选择性别" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  200. // 添加男性选项
  201. UIAlertAction *maleAction = [UIAlertAction actionWithTitle:@"男" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  202. NSLog(@"选择了男");
  203. // 在这里处理选择男性的逻辑
  204. }];
  205. // 添加女性选项
  206. UIAlertAction *femaleAction = [UIAlertAction actionWithTitle:@"女" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  207. NSLog(@"选择了女");
  208. // 在这里处理选择女性的逻辑
  209. }];
  210. // 添加其他选项
  211. UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"其他" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  212. NSLog(@"选择了其他");
  213. // 在这里处理选择其他的逻辑
  214. }];
  215. // 添加取消选项
  216. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  217. NSLog(@"取消了选择");
  218. // 在这里处理取消的逻辑,通常是可选的
  219. }];
  220. // 将操作添加到 UIAlertController 中
  221. [alertController addAction:maleAction];
  222. [alertController addAction:femaleAction];
  223. [alertController addAction:otherAction];
  224. [alertController addAction:cancelAction];
  225. // 显示 UIAlertController
  226. [self presentViewController:alertController animated:YES completion:nil];
  227. }
  228. #pragma mark imagePicker
  229. - (void)openImagePicker {
  230. UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
  231. imagePicker.delegate = self;
  232. imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; // 或者使用UIImagePickerControllerSourceTypeCamera
  233. [self presentViewController:imagePicker animated:YES completion:nil];
  234. }
  235. - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info {
  236. UIImage *chosenImage = info[UIImagePickerControllerEditedImage]; // 如果你设置了允许编辑,则使用这个键;否则使用UIImagePickerControllerOriginalImage
  237. if (!chosenImage) {
  238. chosenImage = info[UIImagePickerControllerOriginalImage];
  239. }
  240. // 裁剪图片,例如裁剪成一个圆形头像
  241. chosenImage = [self imageWithImage:chosenImage scaledToFillSize:CGSizeMake(100, 100)]; // 假设我们想要一个100x100的圆形头像
  242. [self dismissViewControllerAnimated:YES completion:nil];
  243. // 现在你可以调用上传图片的方法了
  244. [self uploadProfilePicture:chosenImage];
  245. }
  246. - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
  247. [self dismissViewControllerAnimated:YES completion:nil];
  248. }
  249. - (UIImage *)imageWithImage:(UIImage *)image scaledToFillSize:(CGSize)size {
  250. UIGraphicsBeginImageContextWithOptions(size, NO, image.scale);
  251. UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, size.width, size.height)];
  252. [path addClip];
  253. [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
  254. UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
  255. UIGraphicsEndImageContext();
  256. return newImage;
  257. }
  258. - (void)uploadProfilePicture:(UIImage *)image {
  259. NSDate *now = [NSDate date];
  260. NSTimeInterval trt = [now timeIntervalSince1970];
  261. NSInteger time = trt*1000;
  262. NSString *fileName = [NSString stringWithFormat:@"%ld.png",(long)time];
  263. NSData *imageData = UIImagePNGRepresentation(image);
  264. [GroupNetApi upLoaddataWToken:imageData fileName:fileName succ:^(int code, NSDictionary * res) {
  265. NSLog(@"res:%@",res);
  266. [self.avatarImageView sd_setImageWithURL:getURL(res[@"url"]) placeholderImage:kImageMake(@"Avatar")];
  267. [self.userInfo setObject:res[@"url"] forKey:@"avatar"];
  268. } fail:^(NSError * _Nonnull error) {
  269. ;
  270. }];
  271. }
  272. #pragma mark lazy
  273. - (UIImageView *)avatarImageView{
  274. if (!_avatarImageView) {
  275. _avatarImageView = [[UIImageView alloc] init];
  276. _avatarImageView.contentMode = UIViewContentModeScaleAspectFit;
  277. _avatarImageView.layer.cornerRadius = 44.f;
  278. _avatarImageView.layer.borderColor = UIColor.whiteColor.CGColor;
  279. _avatarImageView.layer.borderWidth = 3.f;
  280. _avatarImageView.layer.masksToBounds = YES;
  281. }
  282. return _avatarImageView;
  283. }
  284. - (UIButton *)avaterEditBtn{
  285. if (!_avaterEditBtn) {
  286. _avaterEditBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  287. [_avaterEditBtn setImage:[UIImage imageNamed:@"avatar_edit"] forState:UIControlStateNormal];
  288. [_avaterEditBtn setBackgroundColor:UIColor.whiteColor];
  289. _avaterEditBtn.layer.cornerRadius = 14.f;
  290. _avaterEditBtn.layer.masksToBounds = YES;
  291. [_avaterEditBtn addTarget:nil action:@selector(avatarEditButtonClicked) forControlEvents:UIControlEventTouchUpInside];
  292. }
  293. return _avaterEditBtn;
  294. }
  295. - (UILabel *)nameLbl{
  296. if (!_nameLbl) {
  297. _nameLbl = [[UILabel alloc] init];
  298. _nameLbl.text = NSLocalizedString(@"UserInfo_userName", @"");
  299. _nameLbl.textColor = UIColor.whiteColor;
  300. _nameLbl.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  301. }
  302. return _nameLbl;
  303. }
  304. - (UILabel *)signLbl{
  305. if (!_signLbl) {
  306. _signLbl = [[UILabel alloc] init];
  307. _signLbl.text = NSLocalizedString(@"UserInfo_nickName", @"");
  308. _signLbl.textColor = UIColor.whiteColor;
  309. _signLbl.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  310. }
  311. return _signLbl;
  312. }
  313. - (UILabel *)emailLbl{
  314. if (!_emailLbl) {
  315. _emailLbl = [[UILabel alloc] init];
  316. _emailLbl.text = NSLocalizedString(@"UserInfo_email", @"");
  317. _emailLbl.textColor = UIColor.whiteColor;
  318. _emailLbl.font = SYSFONT(16);
  319. }
  320. return _emailLbl;
  321. }
  322. - (UILabel *)mobileLbl{
  323. if (!_mobileLbl) {
  324. _mobileLbl = [[UILabel alloc] init];
  325. _mobileLbl.text = NSLocalizedString(@"UserInfo_phoneNumber", @"");
  326. _mobileLbl.textColor = UIColor.whiteColor;
  327. _mobileLbl.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  328. }
  329. return _mobileLbl;
  330. }
  331. - (UILabel *)genderLbl{
  332. if (!_genderLbl) {
  333. _genderLbl = [[UILabel alloc] init];
  334. _genderLbl.text = NSLocalizedString(@"UserInfo_gender", @"");
  335. _genderLbl.textColor = UIColor.whiteColor;
  336. _genderLbl.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  337. }
  338. return _genderLbl;
  339. }
  340. - (UIStackView *)titleStackView{
  341. if (!_titleStackView) {
  342. _titleStackView = [[UIStackView alloc] initWithArrangedSubviews:@[self.nameLbl,self.signLbl,self.emailLbl,self.mobileLbl,self.genderLbl]];
  343. _titleStackView.axis = UILayoutConstraintAxisVertical;
  344. _titleStackView.alignment = UIStackViewAlignmentFill;
  345. _titleStackView.distribution = UIStackViewDistributionEqualSpacing;
  346. _titleStackView.spacing = 54.f;
  347. }
  348. return _titleStackView;
  349. }
  350. - (UITextField *)nameTextfield{
  351. if (!_nameTextfield) {
  352. _nameTextfield = [[UITextField alloc] init];
  353. _nameTextfield.textColor = UIColor.whiteColor;
  354. _nameTextfield.borderStyle = UITextBorderStyleNone;
  355. _nameTextfield.delegate = self;
  356. _nameTextfield.leftViewMode = UITextFieldViewModeAlways;
  357. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  358. _nameTextfield.leftView = leftView;
  359. _nameTextfield.enabled = NO;
  360. }
  361. return _nameTextfield;
  362. }
  363. - (UITextField *)signTextfield{
  364. if (!_signTextfield) {
  365. _signTextfield = [[UITextField alloc] init];
  366. _signTextfield.textColor = UIColor.whiteColor;
  367. _signTextfield.borderStyle = UITextBorderStyleNone;
  368. _signTextfield.layer.borderWidth = 1.f;
  369. _signTextfield.layer.borderColor = UIColor.lightGrayColor.CGColor;
  370. _signTextfield.layer.cornerRadius = 5.f;
  371. _signTextfield.delegate = self;
  372. _signTextfield.leftViewMode = UITextFieldViewModeAlways;
  373. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  374. _signTextfield.leftView = leftView;
  375. }
  376. return _signTextfield;
  377. }
  378. - (UITextField *)emailTextfield{
  379. if (!_emailTextfield) {
  380. _emailTextfield = [[UITextField alloc] init];
  381. _emailTextfield.textColor = UIColor.whiteColor;
  382. _emailTextfield.borderStyle = UITextBorderStyleNone;
  383. _emailTextfield.layer.borderWidth = 1.f;
  384. _emailTextfield.layer.borderColor = UIColor.lightGrayColor.CGColor;
  385. _emailTextfield.layer.cornerRadius = 5.f;
  386. _emailTextfield.delegate = self;
  387. _emailTextfield.leftViewMode = UITextFieldViewModeAlways;
  388. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  389. _emailTextfield.leftView = leftView;
  390. }
  391. return _emailTextfield;
  392. }
  393. - (UITextField *)mobileTextfield{
  394. if (!_mobileTextfield) {
  395. _mobileTextfield = [[UITextField alloc] init];
  396. _mobileTextfield.textColor = UIColor.whiteColor;
  397. _mobileTextfield.borderStyle = UITextBorderStyleNone;
  398. _mobileTextfield.layer.borderWidth = 1.f;
  399. _mobileTextfield.layer.borderColor = UIColor.lightGrayColor.CGColor;
  400. _mobileTextfield.layer.cornerRadius = 5.f;
  401. _mobileTextfield.delegate = self;
  402. _mobileTextfield.keyboardType = UIKeyboardTypePhonePad;
  403. _mobileTextfield.leftViewMode = UITextFieldViewModeAlways;
  404. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  405. _mobileTextfield.leftView = leftView;
  406. }
  407. return _mobileTextfield;
  408. }
  409. - (UITextField *)genderTextfield{
  410. if (!_genderTextfield) {
  411. _genderTextfield = [[UITextField alloc] init];
  412. _genderTextfield.textColor = UIColor.whiteColor;
  413. _genderTextfield.borderStyle = UITextBorderStyleNone;
  414. _genderTextfield.layer.borderWidth = 1.f;
  415. _genderTextfield.layer.borderColor = UIColor.lightGrayColor.CGColor;
  416. _genderTextfield.layer.cornerRadius = 5.f;
  417. _genderTextfield.delegate = self;
  418. _genderTextfield.leftViewMode = UITextFieldViewModeAlways;
  419. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  420. _genderTextfield.leftView = leftView;
  421. }
  422. return _genderTextfield;
  423. }
  424. - (UIButton *)saveBtn{
  425. if (!_saveBtn) {
  426. _saveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  427. [_saveBtn setTitle:NSLocalizedString(@"NGroupCtr-baocun", @"") forState:UIControlStateNormal];
  428. [_saveBtn setBackgroundColor:globalColor(GCTypeGreen)];
  429. [_saveBtn setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
  430. _saveBtn.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  431. _saveBtn.layer.cornerRadius = 5.f;
  432. _saveBtn.layer.masksToBounds = YES;
  433. [_saveBtn addTarget:self action:@selector(saveButtonClicked) forControlEvents:UIControlEventTouchUpInside];
  434. }
  435. return _saveBtn;
  436. }
  437. - (NSMutableDictionary *)userInfo{
  438. if (!_userInfo) {
  439. _userInfo = [NSMutableDictionary dictionaryWithDictionary:[UDManager.shareInstance getDDManager:dkuserinfo]];
  440. }
  441. return _userInfo;
  442. }
  443. #pragma mark statusBar
  444. - (UIStatusBarStyle)preferredStatusBarStyle{
  445. return UIStatusBarStyleLightContent;
  446. }
  447. @end