PersonalInfoController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. //
  2. // PersonalInfoController.m
  3. // ABtong
  4. //
  5. // Created by gan on 2025/7/28.
  6. //
  7. #import "PersonalInfoController.h"
  8. #import "GDBManager.h"
  9. #import "UDManager.h"
  10. #import "UserNetApi.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. NSDictionary *actuserInfo = [UDManager.shareInstance getDDManager:nkactuserInfo];
  173. NSMutableDictionary *Dict = [NSMutableDictionary dictionaryWithDictionary:actuserInfo];
  174. [Dict setObject:ps[@"id"]?:@"" forKey:@"userId"];
  175. [Dict setObject:ps[@"name"]?:@"" forKey:@"name"];
  176. [Dict setObject:ps[@"avatar"]?:@"" forKey:@"avatar"];
  177. actuserInfo = [Dict copy];
  178. [UDManager.shareInstance setDDManager:actuserInfo key:nkactuserInfo];
  179. [GDBManager.shareInstance updataUserServer:actuserInfo succ:nil fail:nil];
  180. !self->_infoRefreshBlock ?: self->_infoRefreshBlock();
  181. }
  182. }
  183. } fail:^(NSError * _Nonnull error) {
  184. [MBProgressHUD showWithText:@"修改失败"];
  185. }];
  186. }
  187. - (void)avatarEditButtonClicked{
  188. [self openImagePicker];
  189. }
  190. #pragma mark textfield delegate
  191. - (void)textFieldDidEndEditing:(UITextField *)textField{
  192. textField.layer.borderColor = UIColor.lightGrayColor.CGColor;
  193. }
  194. - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
  195. textField.layer.borderColor = globalColor(GCTypeGreen).CGColor;
  196. textField.textColor = UIColor.whiteColor;
  197. if (textField == self.genderTextfield) {
  198. //性别弹窗
  199. [self showGenderSelectionAlert];
  200. return NO;
  201. }
  202. return YES;
  203. }
  204. - (void)showGenderSelectionAlert {
  205. // 创建 UIAlertController
  206. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"选择性别" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  207. // 添加男性选项
  208. UIAlertAction *maleAction = [UIAlertAction actionWithTitle:@"男" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  209. NSLog(@"选择了男");
  210. // 在这里处理选择男性的逻辑
  211. }];
  212. // 添加女性选项
  213. UIAlertAction *femaleAction = [UIAlertAction actionWithTitle:@"女" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  214. NSLog(@"选择了女");
  215. // 在这里处理选择女性的逻辑
  216. }];
  217. // 添加其他选项
  218. UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"其他" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  219. NSLog(@"选择了其他");
  220. // 在这里处理选择其他的逻辑
  221. }];
  222. // 添加取消选项
  223. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  224. NSLog(@"取消了选择");
  225. // 在这里处理取消的逻辑,通常是可选的
  226. }];
  227. // 将操作添加到 UIAlertController 中
  228. [alertController addAction:maleAction];
  229. [alertController addAction:femaleAction];
  230. [alertController addAction:otherAction];
  231. [alertController addAction:cancelAction];
  232. // 显示 UIAlertController
  233. [self presentViewController:alertController animated:YES completion:nil];
  234. }
  235. #pragma mark imagePicker
  236. - (void)openImagePicker {
  237. UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
  238. imagePicker.delegate = self;
  239. imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; // 或者使用UIImagePickerControllerSourceTypeCamera
  240. [self presentViewController:imagePicker animated:YES completion:nil];
  241. }
  242. - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info {
  243. UIImage *chosenImage = info[UIImagePickerControllerEditedImage]; // 如果你设置了允许编辑,则使用这个键;否则使用UIImagePickerControllerOriginalImage
  244. if (!chosenImage) {
  245. chosenImage = info[UIImagePickerControllerOriginalImage];
  246. }
  247. // 裁剪图片,例如裁剪成一个圆形头像
  248. chosenImage = [self imageWithImage:chosenImage scaledToFillSize:CGSizeMake(100, 100)]; // 假设我们想要一个100x100的圆形头像
  249. [self dismissViewControllerAnimated:YES completion:nil];
  250. // 现在你可以调用上传图片的方法了
  251. [self uploadProfilePicture:chosenImage];
  252. }
  253. - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
  254. [self dismissViewControllerAnimated:YES completion:nil];
  255. }
  256. - (UIImage *)imageWithImage:(UIImage *)image scaledToFillSize:(CGSize)size {
  257. UIGraphicsBeginImageContextWithOptions(size, NO, image.scale);
  258. UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, size.width, size.height)];
  259. [path addClip];
  260. [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
  261. UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
  262. UIGraphicsEndImageContext();
  263. return newImage;
  264. }
  265. - (void)uploadProfilePicture:(UIImage *)image {
  266. NSDate *now = [NSDate date];
  267. NSTimeInterval trt = [now timeIntervalSince1970];
  268. NSInteger time = trt*1000;
  269. NSString *fileName = [NSString stringWithFormat:@"%ld.png",(long)time];
  270. NSData *imageData = UIImagePNGRepresentation(image);
  271. [UserNetApi upLoaddataWToken:imageData fileName:fileName succ:^(int code, NSDictionary * res) {
  272. NSLog(@"res:%@",res);
  273. NSString *strcode = res[@"code"];
  274. if([strcode intValue]!=200){
  275. [MBProgressHUD showWithText:@"上传失败"];
  276. return;
  277. }
  278. [self.avatarImageView sd_setImageWithURL:getURL(res[@"url"]) placeholderImage:kImageMake(@"Avatar")];
  279. [self.userInfo setObject:res[@"url"] forKey:@"avatar"];
  280. } fail:^(NSError * _Nonnull error) {
  281. ;
  282. }];
  283. }
  284. #pragma mark lazy
  285. - (UIImageView *)avatarImageView{
  286. if (!_avatarImageView) {
  287. _avatarImageView = [[UIImageView alloc] init];
  288. _avatarImageView.contentMode = UIViewContentModeScaleAspectFit;
  289. _avatarImageView.layer.cornerRadius = 44.f;
  290. _avatarImageView.layer.borderColor = UIColor.whiteColor.CGColor;
  291. _avatarImageView.layer.borderWidth = 3.f;
  292. _avatarImageView.layer.masksToBounds = YES;
  293. }
  294. return _avatarImageView;
  295. }
  296. - (UIButton *)avaterEditBtn{
  297. if (!_avaterEditBtn) {
  298. _avaterEditBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  299. [_avaterEditBtn setImage:[UIImage imageNamed:@"avatar_edit"] forState:UIControlStateNormal];
  300. [_avaterEditBtn setBackgroundColor:UIColor.whiteColor];
  301. _avaterEditBtn.layer.cornerRadius = 14.f;
  302. _avaterEditBtn.layer.masksToBounds = YES;
  303. [_avaterEditBtn addTarget:nil action:@selector(avatarEditButtonClicked) forControlEvents:UIControlEventTouchUpInside];
  304. }
  305. return _avaterEditBtn;
  306. }
  307. - (UILabel *)nameLbl{
  308. if (!_nameLbl) {
  309. _nameLbl = [[UILabel alloc] init];
  310. _nameLbl.text = NSLocalizedString(@"UserInfo_userName", @"");
  311. _nameLbl.textColor = UIColor.whiteColor;
  312. _nameLbl.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  313. }
  314. return _nameLbl;
  315. }
  316. - (UILabel *)signLbl{
  317. if (!_signLbl) {
  318. _signLbl = [[UILabel alloc] init];
  319. _signLbl.text = NSLocalizedString(@"UserInfo_nickName", @"");
  320. _signLbl.textColor = UIColor.whiteColor;
  321. _signLbl.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  322. }
  323. return _signLbl;
  324. }
  325. - (UILabel *)emailLbl{
  326. if (!_emailLbl) {
  327. _emailLbl = [[UILabel alloc] init];
  328. _emailLbl.text = NSLocalizedString(@"UserInfo_email", @"");
  329. _emailLbl.textColor = UIColor.whiteColor;
  330. _emailLbl.font = SYSFONT(16);
  331. }
  332. return _emailLbl;
  333. }
  334. - (UILabel *)mobileLbl{
  335. if (!_mobileLbl) {
  336. _mobileLbl = [[UILabel alloc] init];
  337. _mobileLbl.text = NSLocalizedString(@"call-number", @"");
  338. _mobileLbl.textColor = UIColor.whiteColor;
  339. _mobileLbl.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  340. }
  341. return _mobileLbl;
  342. }
  343. - (UILabel *)genderLbl{
  344. if (!_genderLbl) {
  345. _genderLbl = [[UILabel alloc] init];
  346. _genderLbl.text = NSLocalizedString(@"UserInfo_gender", @"");
  347. _genderLbl.textColor = UIColor.whiteColor;
  348. _genderLbl.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  349. }
  350. return _genderLbl;
  351. }
  352. - (UIStackView *)titleStackView{
  353. if (!_titleStackView) {
  354. _titleStackView = [[UIStackView alloc] initWithArrangedSubviews:@[self.nameLbl,self.signLbl,self.emailLbl,self.mobileLbl,self.genderLbl]];
  355. _titleStackView.axis = UILayoutConstraintAxisVertical;
  356. _titleStackView.alignment = UIStackViewAlignmentFill;
  357. _titleStackView.distribution = UIStackViewDistributionEqualSpacing;
  358. _titleStackView.spacing = 54.f;
  359. }
  360. return _titleStackView;
  361. }
  362. - (UITextField *)nameTextfield{
  363. if (!_nameTextfield) {
  364. _nameTextfield = [[UITextField alloc] init];
  365. _nameTextfield.textColor = UIColor.whiteColor;
  366. _nameTextfield.borderStyle = UITextBorderStyleNone;
  367. _nameTextfield.delegate = self;
  368. _nameTextfield.leftViewMode = UITextFieldViewModeAlways;
  369. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  370. _nameTextfield.leftView = leftView;
  371. _nameTextfield.enabled = NO;
  372. }
  373. return _nameTextfield;
  374. }
  375. - (UITextField *)signTextfield{
  376. if (!_signTextfield) {
  377. _signTextfield = [[UITextField alloc] init];
  378. _signTextfield.textColor = UIColor.whiteColor;
  379. _signTextfield.borderStyle = UITextBorderStyleNone;
  380. _signTextfield.layer.borderWidth = 1.f;
  381. _signTextfield.layer.borderColor = UIColor.lightGrayColor.CGColor;
  382. _signTextfield.layer.cornerRadius = 5.f;
  383. _signTextfield.delegate = self;
  384. _signTextfield.leftViewMode = UITextFieldViewModeAlways;
  385. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  386. _signTextfield.leftView = leftView;
  387. }
  388. return _signTextfield;
  389. }
  390. - (UITextField *)emailTextfield{
  391. if (!_emailTextfield) {
  392. _emailTextfield = [[UITextField alloc] init];
  393. _emailTextfield.textColor = UIColor.whiteColor;
  394. _emailTextfield.borderStyle = UITextBorderStyleNone;
  395. _emailTextfield.layer.borderWidth = 1.f;
  396. _emailTextfield.layer.borderColor = UIColor.lightGrayColor.CGColor;
  397. _emailTextfield.layer.cornerRadius = 5.f;
  398. _emailTextfield.delegate = self;
  399. _emailTextfield.leftViewMode = UITextFieldViewModeAlways;
  400. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  401. _emailTextfield.leftView = leftView;
  402. }
  403. return _emailTextfield;
  404. }
  405. - (UITextField *)mobileTextfield{
  406. if (!_mobileTextfield) {
  407. _mobileTextfield = [[UITextField alloc] init];
  408. _mobileTextfield.textColor = UIColor.whiteColor;
  409. _mobileTextfield.borderStyle = UITextBorderStyleNone;
  410. _mobileTextfield.layer.borderWidth = 1.f;
  411. _mobileTextfield.layer.borderColor = UIColor.lightGrayColor.CGColor;
  412. _mobileTextfield.layer.cornerRadius = 5.f;
  413. _mobileTextfield.delegate = self;
  414. _mobileTextfield.keyboardType = UIKeyboardTypePhonePad;
  415. _mobileTextfield.leftViewMode = UITextFieldViewModeAlways;
  416. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  417. _mobileTextfield.leftView = leftView;
  418. }
  419. return _mobileTextfield;
  420. }
  421. - (UITextField *)genderTextfield{
  422. if (!_genderTextfield) {
  423. _genderTextfield = [[UITextField alloc] init];
  424. _genderTextfield.textColor = UIColor.whiteColor;
  425. _genderTextfield.borderStyle = UITextBorderStyleNone;
  426. _genderTextfield.layer.borderWidth = 1.f;
  427. _genderTextfield.layer.borderColor = UIColor.lightGrayColor.CGColor;
  428. _genderTextfield.layer.cornerRadius = 5.f;
  429. _genderTextfield.delegate = self;
  430. _genderTextfield.leftViewMode = UITextFieldViewModeAlways;
  431. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 50)];
  432. _genderTextfield.leftView = leftView;
  433. }
  434. return _genderTextfield;
  435. }
  436. - (UIButton *)saveBtn{
  437. if (!_saveBtn) {
  438. _saveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  439. [_saveBtn setTitle:NSLocalizedString(@"NGroupCtr-baocun", @"") forState:UIControlStateNormal];
  440. [_saveBtn setBackgroundColor:globalColor(GCTypeGreen)];
  441. [_saveBtn setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
  442. _saveBtn.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  443. _saveBtn.layer.cornerRadius = 5.f;
  444. _saveBtn.layer.masksToBounds = YES;
  445. [_saveBtn addTarget:self action:@selector(saveButtonClicked) forControlEvents:UIControlEventTouchUpInside];
  446. }
  447. return _saveBtn;
  448. }
  449. - (NSMutableDictionary *)userInfo{
  450. if (!_userInfo) {
  451. _userInfo = [NSMutableDictionary dictionaryWithDictionary:[UDManager.shareInstance getDDManager:nkactuserInfo]];
  452. }
  453. return _userInfo;
  454. }
  455. #pragma mark statusBar
  456. - (UIStatusBarStyle)preferredStatusBarStyle{
  457. return UIStatusBarStyleLightContent;
  458. }
  459. @end