LoginViewController.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // LoginViewController.m
  3. // WSCloudStorage
  4. //
  5. // Created by JonathanH on 2017/7/27.
  6. // Copyright © 2017年 wswinsoft. All rights reserved.
  7. //
  8. #import "LoginViewController.h"
  9. @interface LoginViewController ()
  10. @property(nonatomic,weak)UIImageView *logoimageView;
  11. @property(nonatomic,weak)UITextField *usernameTF;
  12. @property(nonatomic,weak)UITextField *userpwdTF;
  13. @property(nonatomic,weak)UIButton *loginBtn;
  14. @end
  15. @implementation LoginViewController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. self.view.backgroundColor = [UIColor redColor];
  19. // Do any additional setup after loading the view.
  20. [self initSubViews];
  21. //[self initData];
  22. }
  23. - (void)initSubViews{
  24. CGFloat screenw = SCREEN_WIDTH;
  25. //CGFloat screenh = SCREEN_HEIGHT;
  26. UIImageView *logoimageView = [[UIImageView alloc]init];
  27. logoimageView.frame = CGRectMake((screenw-80)/2.0, NavBarHeight+20, 80, 80);
  28. [self.view addSubview:logoimageView];
  29. self.logoimageView = logoimageView;
  30. UITextField *usernametf = [[UITextField alloc]init];
  31. usernametf.clearButtonMode = UITextFieldViewModeWhileEditing;
  32. usernametf.frame = CGRectMake(20, MaxYplus(logoimageView, 20),screenw - 40, 40);
  33. [self.view addSubview:usernametf];
  34. self.usernameTF = usernametf;
  35. UITextField *userpwdtf = [[UITextField alloc]init];
  36. userpwdtf.clearButtonMode = UITextFieldViewModeWhileEditing;
  37. userpwdtf.frame = CGRectMake(20, MaxYplus(logoimageView,2),screenw - 40, 40);
  38. [self.view addSubview:userpwdtf];
  39. self.userpwdTF = userpwdtf;
  40. UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeSystem];
  41. loginBtn.backgroundColor = [UIColor blueColor];
  42. loginBtn.frame = CGRectMake(20, MaxYplus(userpwdtf, 20), screenw -40, 60);
  43. [self.view addSubview:loginBtn];
  44. self.loginBtn = loginBtn;
  45. }
  46. - (void)initData{
  47. self.logoimageView.image = [UIImage imageNamed:@"defaut_avater"];
  48. self.usernameTF.placeholder = @"用户名";
  49. self.userpwdTF.placeholder = @"密码";
  50. }
  51. - (void)didReceiveMemoryWarning {
  52. [super didReceiveMemoryWarning];
  53. // Dispose of any resources that can be recreated.
  54. }
  55. /*
  56. #pragma mark - Navigation
  57. // In a storyboard-based application, you will often want to do a little preparation before navigation
  58. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  59. // Get the new view controller using [segue destinationViewController].
  60. // Pass the selected object to the new view controller.
  61. }
  62. */
  63. @end