PreferencesViewController.m 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // PreferencesViewController.m
  3. // WSCloudStorage
  4. //
  5. // Created by JonathanH on 2017/8/2.
  6. // Copyright © 2017年 wswinsoft. All rights reserved.
  7. //
  8. #import "PreferencesViewController.h"
  9. #define AvatarWH 80
  10. #define MaxX(view) CGRectGetMaxX(view.frame)
  11. #define EqualY(view) view.frame.origin.y
  12. //#define MaxXPlus(MaxX(v),plusnumber) (MaxX(v) + plusnumber)
  13. //Avatar frame
  14. #define MarginLeft 20
  15. @interface PreferencesViewController()<UITableViewDelegate,UITableViewDataSource>
  16. @property(nonatomic,weak)UIImageView *avatarview;
  17. @property(nonatomic,weak)UIProgressView *progressview;
  18. @property(nonatomic,weak)UITableView *tableview;
  19. @end
  20. @implementation PreferencesViewController
  21. -(void)viewDidLoad{
  22. [super viewDidLoad];
  23. }
  24. -(void)initSubViews{
  25. //|----|namelabel
  26. //|头像 |progress
  27. //|____|descritionlabel
  28. CGFloat screenW = SCREEN_WIDTH;
  29. CGFloat leftRightW;
  30. UIImageView *avatarview = [[UIImageView alloc]init];
  31. avatarview.layer.cornerRadius = AvatarWH/2;
  32. avatarview.layer.masksToBounds = YES;
  33. avatarview.frame = CGRectMake(MarginLeft, 20, AvatarWH, AvatarWH);
  34. avatarview.backgroundColor = [UIColor grayColor];
  35. [self.view addSubview:avatarview];
  36. self.avatarview = avatarview;
  37. leftRightW = screenW - MaxX(avatarview) - 10;//10 为何下一个控件的x距离
  38. UILabel *namelab = [[UILabel alloc]init];
  39. namelab.textColor = [UIColor blackColor];
  40. namelab.font = [UIFont boldSystemFontOfSize:18];
  41. namelab.text = [userDefaults objectForKey:@"displayName"];
  42. namelab.frame = CGRectMake(MaxX(avatarview)+ 10, EqualY(avatarview), 200, 30);//临时写死
  43. [self.view addSubview:namelab];
  44. UIProgressView *progressview = [[UIProgressView alloc]initWithFrame:CGRectMake(screenW-leftRightW,avatarview.centerY -2 , leftRightW, 4)];
  45. progressview.progressTintColor = RGB(<#r#>, <#g#>, <#b#>) progressview.backgroundColor = [UIColor lightGrayColor]
  46. }
  47. @end