//
//  LoginViewController.m
//  WSCloudStorage
//
//  Created by JonathanH on 2017/7/27.
//  Copyright © 2017年 wswinsoft. All rights reserved.
//

#import "LoginViewController.h"

@interface LoginViewController ()
@property(nonatomic,weak)UIImageView *logoimageView;
@property(nonatomic,weak)UITextField *usernameTF;
@property(nonatomic,weak)UITextField *userpwdTF;
@property(nonatomic,weak)UIButton *loginBtn;
@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    // Do any additional setup after loading the view.
    [self initSubViews];
    //[self initData];
}
- (void)initSubViews{
    CGFloat screenw = SCREEN_WIDTH;
    //CGFloat screenh = SCREEN_HEIGHT;
    UIImageView *logoimageView = [[UIImageView alloc]init];
    logoimageView.frame = CGRectMake((screenw-80)/2.0, NavBarHeight+20, 80, 80);
    [self.view addSubview:logoimageView];
    self.logoimageView = logoimageView;
    UITextField *usernametf = [[UITextField alloc]init];
    usernametf.clearButtonMode = UITextFieldViewModeWhileEditing;
    
    
    usernametf.frame = CGRectMake(20, MaxYplus(logoimageView, 20),screenw - 40, 40);
    [self.view addSubview:usernametf];
    self.usernameTF = usernametf;
    
    UITextField *userpwdtf = [[UITextField alloc]init];
    userpwdtf.clearButtonMode = UITextFieldViewModeWhileEditing;
    userpwdtf.frame = CGRectMake(20, MaxYplus(logoimageView,2),screenw - 40, 40);
    [self.view addSubview:userpwdtf];
    self.userpwdTF = userpwdtf;
    
    UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    loginBtn.backgroundColor = [UIColor blueColor];
    loginBtn.frame = CGRectMake(20, MaxYplus(userpwdtf, 20), screenw -40, 60);
    [self.view addSubview:loginBtn];
    self.loginBtn = loginBtn;
}
- (void)initData{
    self.logoimageView.image = [UIImage imageNamed:@"defaut_avater"];
    self.usernameTF.placeholder = @"用户名";
    self.userpwdTF.placeholder = @"密码";
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
