| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- //
- // PreferencesViewController.m
- // WSCloudStorage
- //
- // Created by JonathanH on 2017/8/2.
- // Copyright © 2017年 wswinsoft. All rights reserved.
- //
- #import "PreferencesViewController.h"
- #define AvatarWH 80
- #define MaxX(view) CGRectGetMaxX(view.frame)
- #define EqualY(view) view.frame.origin.y
- //#define MaxXPlus(MaxX(v),plusnumber) (MaxX(v) + plusnumber)
- //Avatar frame
- #define MarginLeft 20
- @interface PreferencesViewController()<UITableViewDelegate,UITableViewDataSource>
- @property(nonatomic,weak)UIImageView *avatarview;
- @property(nonatomic,weak)UIProgressView *progressview;
- @property(nonatomic,weak)UITableView *tableview;
- @end
- @implementation PreferencesViewController
- -(void)viewDidLoad{
- [super viewDidLoad];
-
-
- }
- -(void)initSubViews{
- //|----|namelabel
- //|头像 |progress
- //|____|descritionlabel
- CGFloat screenW = SCREEN_WIDTH;
- CGFloat leftRightW;
- UIImageView *avatarview = [[UIImageView alloc]init];
- avatarview.layer.cornerRadius = AvatarWH/2;
- avatarview.layer.masksToBounds = YES;
- avatarview.frame = CGRectMake(MarginLeft, 20, AvatarWH, AvatarWH);
- avatarview.backgroundColor = [UIColor grayColor];
- [self.view addSubview:avatarview];
- self.avatarview = avatarview;
-
- leftRightW = screenW - MaxX(avatarview) - 10;//10 为何下一个控件的x距离
-
- UILabel *namelab = [[UILabel alloc]init];
- namelab.textColor = [UIColor blackColor];
- namelab.font = [UIFont boldSystemFontOfSize:18];
- namelab.text = [userDefaults objectForKey:@"displayName"];
- namelab.frame = CGRectMake(MaxX(avatarview)+ 10, EqualY(avatarview), 200, 30);//临时写死
- [self.view addSubview:namelab];
-
- UIProgressView *progressview = [[UIProgressView alloc]initWithFrame:CGRectMake(screenW-leftRightW,avatarview.centerY -2 , leftRightW, 4)];
- progressview.progressTintColor = RGB(<#r#>, <#g#>, <#b#>) progressview.backgroundColor = [UIColor lightGrayColor]
- }
- @end
|