Jelajahi Sumber

登录页面完成包括接口嵌入

huangyp 6 tahun lalu
induk
melakukan
e3bcf5c9e5
28 mengubah file dengan 701 tambahan dan 7 penghapusan
  1. 2 0
      UU_Ent/Podfile
  2. 38 2
      UU_Ent/UU_Ent.xcodeproj/project.pbxproj
  3. 13 0
      UU_Ent/UU_Ent/Modules/App/AppDelegate.m
  4. 204 3
      UU_Ent/UU_Ent/Modules/Login/Main/Controllers/YRLoginVC.m
  5. 6 0
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/Contents.json
  6. 23 0
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newDELETE.imageset/Contents.json
  7. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newDELETE.imageset/UU_newDELETE@1x.png
  8. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newDELETE.imageset/UU_newDELETE@2x.png
  9. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newDELETE.imageset/UU_newDELETE@3x.png
  10. 23 0
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginAccount.imageset/Contents.json
  11. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginAccount.imageset/UU_newLoginAccount@1x.png
  12. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginAccount.imageset/UU_newLoginAccount@2x.png
  13. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginAccount.imageset/UU_newLoginAccount@3x.png
  14. 23 0
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginPassword.imageset/Contents.json
  15. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginPassword.imageset/UU_newLoginPassword@1x.png
  16. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginPassword.imageset/UU_newLoginPassword@2x.png
  17. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginPassword.imageset/UU_newLoginPassword@3x.png
  18. 23 0
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newpg5-log in.imageset/Contents.json
  19. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newpg5-log in.imageset/UU_newpg5-log in@1x.png
  20. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newpg5-log in.imageset/UU_newpg5-log in@2x.png
  21. TEMPAT SAMPAH
      UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newpg5-log in.imageset/UU_newpg5-log in@3x.png
  22. 10 2
      UU_Ent/UU_Ent/Supporting Files/UU_Ent.pch
  23. 25 0
      UU_Ent/UU_Ent/Utils/UIButton/UIButton+Layout.h
  24. 115 0
      UU_Ent/UU_Ent/Utils/UIButton/UIButton+Layout.m
  25. 25 0
      UU_Ent/UU_Ent/Utils/UIButton/YRButton.h
  26. 49 0
      UU_Ent/UU_Ent/Utils/UIButton/YRButton.m
  27. 30 0
      UU_Ent/UU_Ent/Utils/UIColor/UIColor+HexColor.h
  28. 92 0
      UU_Ent/UU_Ent/Utils/UIColor/UIColor+HexColor.m

+ 2 - 0
UU_Ent/Podfile

@@ -11,6 +11,8 @@ target 'UU_Ent' do
     pod 'Masonry'
     pod 'MJExtension'
     pod 'SDWebImage'
+    pod 'IQKeyboardManager'
+    
   target 'UU_EntTests' do
     inherit! :search_paths
     # Pods for testing

+ 38 - 2
UU_Ent/UU_Ent.xcodeproj/project.pbxproj

@@ -8,6 +8,9 @@
 
 /* Begin PBXBuildFile section */
 		27029BC72276A23400D53A94 /* YRLoginVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 27029BC62276A23400D53A94 /* YRLoginVC.m */; };
+		27029BCC2277063F00D53A94 /* UIColor+HexColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 27029BCB2277063F00D53A94 /* UIColor+HexColor.m */; };
+		27029BD0227709CC00D53A94 /* UIButton+Layout.m in Sources */ = {isa = PBXBuildFile; fileRef = 27029BCE227709CC00D53A94 /* UIButton+Layout.m */; };
+		27029BD32277E16300D53A94 /* YRButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 27029BD22277E16300D53A94 /* YRButton.m */; };
 		3FE47A8D89A70D18F98B1E41 /* libPods-UU_EntUITests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F4F857DEEC69AEDCFACDFD51 /* libPods-UU_EntUITests.a */; };
 		99C6FE6122768B5C00C7070A /* UU_EntTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 99C6FE6022768B5C00C7070A /* UU_EntTests.m */; };
 		99C6FE6C22768B5C00C7070A /* UU_EntUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 99C6FE6B22768B5C00C7070A /* UU_EntUITests.m */; };
@@ -53,6 +56,12 @@
 		13A4F2D13DACD5857BD40BDE /* Pods-UU_Ent.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UU_Ent.release.xcconfig"; path = "Pods/Target Support Files/Pods-UU_Ent/Pods-UU_Ent.release.xcconfig"; sourceTree = "<group>"; };
 		27029BC52276A23400D53A94 /* YRLoginVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YRLoginVC.h; sourceTree = "<group>"; };
 		27029BC62276A23400D53A94 /* YRLoginVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YRLoginVC.m; sourceTree = "<group>"; };
+		27029BCA2277063F00D53A94 /* UIColor+HexColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+HexColor.h"; sourceTree = "<group>"; };
+		27029BCB2277063F00D53A94 /* UIColor+HexColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+HexColor.m"; sourceTree = "<group>"; };
+		27029BCE227709CC00D53A94 /* UIButton+Layout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+Layout.m"; sourceTree = "<group>"; };
+		27029BCF227709CC00D53A94 /* UIButton+Layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+Layout.h"; sourceTree = "<group>"; };
+		27029BD12277E16300D53A94 /* YRButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YRButton.h; sourceTree = "<group>"; };
+		27029BD22277E16300D53A94 /* YRButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YRButton.m; sourceTree = "<group>"; };
 		49A8B37D50A80EFFD84620EC /* Pods-UU_EntTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UU_EntTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UU_EntTests/Pods-UU_EntTests.release.xcconfig"; sourceTree = "<group>"; };
 		49D3F089EECE8E3EDF7D2E1C /* Pods-UU_EntUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UU_EntUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UU_EntUITests/Pods-UU_EntUITests.release.xcconfig"; sourceTree = "<group>"; };
 		71B4DF45C8EC3368ACFC4193 /* Pods-UU_Ent.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UU_Ent.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UU_Ent/Pods-UU_Ent.debug.xcconfig"; sourceTree = "<group>"; };
@@ -131,6 +140,26 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		27029BC9227705DB00D53A94 /* UIColor */ = {
+			isa = PBXGroup;
+			children = (
+				27029BCA2277063F00D53A94 /* UIColor+HexColor.h */,
+				27029BCB2277063F00D53A94 /* UIColor+HexColor.m */,
+			);
+			path = UIColor;
+			sourceTree = "<group>";
+		};
+		27029BCD227709A700D53A94 /* UIButton */ = {
+			isa = PBXGroup;
+			children = (
+				27029BCF227709CC00D53A94 /* UIButton+Layout.h */,
+				27029BCE227709CC00D53A94 /* UIButton+Layout.m */,
+				27029BD12277E16300D53A94 /* YRButton.h */,
+				27029BD22277E16300D53A94 /* YRButton.m */,
+			);
+			path = UIButton;
+			sourceTree = "<group>";
+		};
 		99C6FE3B22768B5B00C7070A = {
 			isa = PBXGroup;
 			children = (
@@ -289,6 +318,8 @@
 		99C6FE8D22768EC000C7070A /* Utils */ = {
 			isa = PBXGroup;
 			children = (
+				27029BCD227709A700D53A94 /* UIButton */,
+				27029BC9227705DB00D53A94 /* UIColor */,
 				99C6FF182276DD2400C7070A /* tableView */,
 			);
 			path = Utils;
@@ -785,16 +816,18 @@
 			files = (
 			);
 			inputPaths = (
-				"${SRCROOT}/Pods/Target Support Files/Pods-UU_Ent/Pods-UU_Ent-resources.sh",
+				"${PODS_ROOT}/Target Support Files/Pods-UU_Ent/Pods-UU_Ent-resources.sh",
+				"${PODS_ROOT}/IQKeyboardManager/IQKeyboardManager/Resources/IQKeyboardManager.bundle",
 				"${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle",
 			);
 			name = "[CP] Copy Pods Resources";
 			outputPaths = (
+				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/IQKeyboardManager.bundle",
 				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle",
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-UU_Ent/Pods-UU_Ent-resources.sh\"\n";
+			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UU_Ent/Pods-UU_Ent-resources.sh\"\n";
 			showEnvVarsInLog = 0;
 		};
 		A2F6040888740937A057571A /* [CP] Check Pods Manifest.lock */ = {
@@ -823,6 +856,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				99C6FED12276982F00C7070A /* YRTabBar.m in Sources */,
+				27029BD0227709CC00D53A94 /* UIButton+Layout.m in Sources */,
 				99C6FF232276E4C000C7070A /* YRMsgMainCell.m in Sources */,
 				99C6FECB227696CA00C7070A /* YRMsgVC.m in Sources */,
 				99C6FE9222768EC000C7070A /* main.m in Sources */,
@@ -835,6 +869,8 @@
 				99C6FEC82276966600C7070A /* YRWebVC.m in Sources */,
 				99C6FEC02276957400C7070A /* YRMineVC.m in Sources */,
 				99C6FF1B2276DD3900C7070A /* YRTableView.m in Sources */,
+				27029BD32277E16300D53A94 /* YRButton.m in Sources */,
+				27029BCC2277063F00D53A94 /* UIColor+HexColor.m in Sources */,
 				99C6FE8F22768EC000C7070A /* AppDelegate.m in Sources */,
 				99C6FEBA2276950C00C7070A /* YRMainVC.m in Sources */,
 				27029BC72276A23400D53A94 /* YRLoginVC.m in Sources */,

+ 13 - 0
UU_Ent/UU_Ent/Modules/App/AppDelegate.m

@@ -19,6 +19,8 @@
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     // Override point for customization after application launch.
     
+    [self configKeyboardManager];
+    
     YRLoginVC *loginVC = [[YRLoginVC alloc]init];
     
     loginVC.completed = ^(BOOL success) {
@@ -38,6 +40,17 @@
     return YES;
 }
 
+#pragma mark - 配置键盘
+-(void)configKeyboardManager{
+    
+    IQKeyboardManager *manager = [IQKeyboardManager sharedManager];
+    manager.enable = NO; // 控制整个功能是否启用。
+    manager.shouldResignOnTouchOutside = YES; // 控制点击背景是否收起键盘
+    manager.shouldToolbarUsesTextFieldTintColor = YES; // 控制键盘上的工具条文字颜色是否用户自定义
+    manager.enableAutoToolbar = NO; // 控制是否显示键盘上的工具条
+    manager.toolbarManageBehaviour = IQAutoToolbarByTag; // 最新版的设置键盘的returnKey的关键字 ,可以点击键盘上的next键,自动跳转到下一个输入框,最后一个输入框点击完成,自动收起键盘。
+    
+}
 
 - (void)applicationWillResignActive:(UIApplication *)application {
     // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

+ 204 - 3
UU_Ent/UU_Ent/Modules/Login/Main/Controllers/YRLoginVC.m

@@ -11,11 +11,11 @@
 #import <GRPCClient/GRPCCall+Tests.h>
 #import <UU_Ent/Account.pbrpc.h>
 
-@interface YRLoginVC ()
+@interface YRLoginVC ()<UITextFieldDelegate>
+@property (nonatomic,strong) UIScrollView *scrollView;
 @property (nonatomic,strong) UITextField *passwordTF;
 @property (nonatomic,strong) UITextField *phoneTF;
-@property (nonatomic,strong) UIButton *loginBtn;
-@property (nonatomic,strong) UIButton *registerBtn;
+@property (nonatomic,strong) YRButton *loginBtn;
 @property (nonatomic,strong) UIImageView *headImageV;
 
 @end
@@ -27,4 +27,205 @@
     // Do any additional setup after loading the view.
 
 }
+
+#pragma mark --- 登录操作
+-(void)loginAction
+{
+    [GRPCCall useInsecureConnectionsForHost:kHostAddress];
+    
+    AccountService *client = [[AccountService alloc]initWithHost:kHostAddress];
+    
+    AccountSigninRequest *request = [AccountSigninRequest message];
+    
+    DeviceInfo *model = [DeviceInfo new];
+    
+    model.os = DeviceInfo_OS_Ios;
+    
+    request.deviceInfo = model;
+    
+    request.mobile = _phoneTF.text;
+    
+    request.password = _passwordTF.text;
+    
+    [client signinWithRequest:request handler:^(AccountSigninResponse * _Nullable response, NSError * _Nullable error) {
+        
+        self.completed(YES);
+        
+    }];
+}
+
+#pragma mark --- UITextField Delegate
+- (BOOL)textFieldShouldReturn:(UITextField *)textField
+{
+    [self.view endEditing:YES];
+    return YES;
+}
+
+- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
+{
+    if ([string isEqualToString:@"\n"]){ //判断输入的字是否是回车,即按下return
+        //在这里做你响应return键的代码
+        [textField resignFirstResponder];
+        return NO; //这里返回NO,就代表return键值失效,即页面上按下return,不会出现换行,如果为yes,则输入页面会换行
+    }
+    
+    NSString *allText = [textField.text stringByReplacingCharactersInRange:range withString:string];
+    
+    [self changeRegisterBtn:allText and:textField];
+    
+    
+    return YES;
+}
+
+-(BOOL)textFieldShouldClear:(UITextField *)textField
+{
+    _loginBtn.enabled = NO;
+    return YES;
+}
+
+- (void)changeRegisterBtn:(NSString *)text and:(UITextField *)textField
+{
+    if (textField == _phoneTF) {
+        if (_passwordTF.text.length!=0 && text.length!=0) {
+            _loginBtn.enabled = YES;
+        }else
+            _loginBtn.enabled = NO;
+    }
+    if (textField == _passwordTF) {
+        if (_phoneTF.text.length!=0 && text.length!=0) {
+            _loginBtn.enabled = YES;
+        }else
+            _loginBtn.enabled = NO;
+    }
+    
+}
+
+#pragma mark --- 注意:事件类型是:`UIControlEventEditingChanged`
+-(void)passConTextChange:(id)sender{
+//    UITextField* target = (UITextField*)sender;
+//    if (target.text.length == 11) {
+//        if ([target.text isEqualToString:[[NSUserDefaults standardUserDefaults] objectForKey:kMY_USER_LoginName]]) {
+//            [g_server getHeadImageSmall:g_server.myself.userId imageView:_headImage];
+//        }else{
+//            _headImage.image = [UIImage imageNamed:@"UU_newPublicPic"];
+//        }
+//    }else{
+//        _headImage.image = [UIImage imageNamed:@"UU_newPublicPic"];
+//    }
+}
+
+-(void)pwdTextChanged:(id)sender {
+    UITextField* target = (UITextField*)sender;
+    
+    [self changeRegisterBtn:target.text and:target];
+}
+
+#pragma mark --- 设置UI
+-(void)setUpUI
+{
+    [self.view addSubview:self.scrollView];
+    [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.left.right.equalTo(self.view);
+        make.width.mas_equalTo(self_width);
+        make.height.mas_equalTo(self_height);
+    }];
+    
+    UIImageView *bgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.scrollView.frame.size.width, self.scrollView.frame.size.height)];
+    bgView.image = [UIImage imageNamed:@"UU_newpg5-log in"];
+    [self.scrollView addSubview:bgView];
+    
+    [self.scrollView addSubview:self.headImageV];
+    
+    UIView *firstView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.headImageV.frame)+50, self_width, 50)];
+    firstView.backgroundColor = [UIColor clearColor];
+    [self.scrollView addSubview:firstView];
+    
+    UIView *secondView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(firstView.frame)+2, self_width, 50)];
+    secondView.backgroundColor = [UIColor clearColor];
+    [self.scrollView addSubview:secondView];
+    
+    UIImageView *account = [[UIImageView alloc]initWithFrame:CGRectMake(31, 15, 20, 20)];
+    account.image = [UIImage imageNamed:@"UU_newLoginAccount"];
+    [firstView addSubview:account];
+    
+    UIImageView *password = [[UIImageView alloc]initWithFrame:CGRectMake(31, 15, 20, 20)];
+    password.image = [UIImage imageNamed:@"UU_newLoginPassword"];
+    [secondView addSubview:password];
+    
+    UIImageView *line1 = [[UIImageView alloc]initWithFrame:CGRectMake(20, 48, self_width-40, 2)];
+    line1.backgroundColor = HexColor(@"#939393");
+    [firstView addSubview:line1];
+    
+    UIImageView *line2 = [[UIImageView alloc]initWithFrame:CGRectMake(20, 48, self_width-40, 2)];
+    line2.backgroundColor = HexColor(@"#939393");
+    [secondView addSubview:line2];
+    
+    _phoneTF = [[UITextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX(account.frame)+14, 0, self_width-90, 50)];
+    _phoneTF.delegate = self;
+    _phoneTF.autocorrectionType = UITextAutocorrectionTypeNo;
+    _phoneTF.autocapitalizationType = UITextAutocapitalizationTypeNone;
+    _phoneTF.enablesReturnKeyAutomatically = YES;
+    _phoneTF.returnKeyType = UIReturnKeyDone;
+    UIButton *button1 = [_phoneTF valueForKey:@"_clearButton"];
+    [button1 setImage:[UIImage imageNamed:@"UU_newDELETE"] forState:UIControlStateNormal];
+    _phoneTF.clearButtonMode = UITextFieldViewModeWhileEditing;
+    _phoneTF.placeholder = @"登录";
+    _phoneTF.userInteractionEnabled = YES;
+    _phoneTF.backgroundColor = [UIColor clearColor];
+    _phoneTF.textColor = HexColor(@"#FFFFFF");
+    _phoneTF.keyboardType = UIKeyboardTypeNumberPad;
+    _phoneTF.font = [UIFont systemFontOfSize:18];
+    [_phoneTF setValue:HexColor(@"#FFFFFF") forKeyPath:@"_placeholderLabel.textColor"];
+    [firstView addSubview:_phoneTF];
+    [_phoneTF addTarget:self action:@selector(passConTextChange:) forControlEvents:UIControlEventEditingChanged];
+    _phoneTF.text = @"15018524229";
+    
+    _passwordTF = [[UITextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX(password.frame)+14, 0, self_width-90, 50)];
+    _passwordTF.delegate = self;
+    _passwordTF.autocorrectionType = UITextAutocorrectionTypeNo;
+    _passwordTF.autocapitalizationType = UITextAutocapitalizationTypeNone;
+    _passwordTF.enablesReturnKeyAutomatically = YES;
+    _passwordTF.returnKeyType = UIReturnKeyDone;
+    UIButton *button2 = [_passwordTF valueForKey:@"_clearButton"];
+    [button2 setImage:[UIImage imageNamed:@"UU_newDELETE"] forState:UIControlStateNormal];
+    _passwordTF.clearButtonMode = UITextFieldViewModeWhileEditing;
+    _passwordTF.placeholder = @"密码";
+    _passwordTF.secureTextEntry = YES;
+    _passwordTF.userInteractionEnabled = YES;
+    _passwordTF.backgroundColor = [UIColor clearColor];
+    _passwordTF.textColor = HexColor(@"#FFFFFF");
+    _passwordTF.font = [UIFont systemFontOfSize:18];
+    [_passwordTF setValue:HexColor(@"#FFFFFF") forKeyPath:@"_placeholderLabel.textColor"];
+    [secondView addSubview:_passwordTF];
+    [_passwordTF addTarget:self action:@selector(pwdTextChanged:) forControlEvents:UIControlEventAllEditingEvents|UIControlEventValueChanged];
+    _passwordTF.text = @"111111";
+    
+    self.loginBtn = [[YRButton alloc]initWithTitle:@"登录" titleColor:nil titleFont:18 buttonNormalColor:nil buttonSelectColor:nil buttonDiabledColor:nil];
+    self.loginBtn.frame = CGRectMake(20, CGRectGetMaxY(secondView.frame)+25, self_width-40, 40);
+    [self.scrollView addSubview:self.loginBtn];
+    [self.loginBtn addTarget:self action:@selector(loginAction) forControlEvents:UIControlEventTouchUpInside];
+}
+
+#pragma mark --- lazy
+-(UIScrollView *)scrollView{
+    if (!_scrollView) {
+        _scrollView = [[UIScrollView alloc]initWithFrame:self.view.frame];
+        _scrollView.backgroundColor = [UIColor redColor];
+    }
+    return _scrollView;
+}
+
+-(UIImageView *)headImageV
+{
+    if (!_headImageV) {
+        _headImageV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 70, 70)];
+        _headImageV.layer.masksToBounds = YES;
+        _headImageV.layer.cornerRadius = 35;
+        _headImageV.layer.borderColor = [UIColor whiteColor].CGColor;
+        _headImageV.layer.borderWidth = 3;
+        _headImageV.center = CGPointMake(self_width/2, 81);
+    }
+    return _headImageV;
+}
+
 @end

+ 6 - 0
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 23 - 0
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newDELETE.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newDELETE@1x.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newDELETE@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newDELETE@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newDELETE.imageset/UU_newDELETE@1x.png


TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newDELETE.imageset/UU_newDELETE@2x.png


TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newDELETE.imageset/UU_newDELETE@3x.png


+ 23 - 0
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginAccount.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newLoginAccount@1x.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newLoginAccount@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newLoginAccount@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginAccount.imageset/UU_newLoginAccount@1x.png


TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginAccount.imageset/UU_newLoginAccount@2x.png


TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginAccount.imageset/UU_newLoginAccount@3x.png


+ 23 - 0
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginPassword.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newLoginPassword@1x.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newLoginPassword@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newLoginPassword@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginPassword.imageset/UU_newLoginPassword@1x.png


TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginPassword.imageset/UU_newLoginPassword@2x.png


TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newLoginPassword.imageset/UU_newLoginPassword@3x.png


+ 23 - 0
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newpg5-log in.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newpg5-log in@1x.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newpg5-log in@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_newpg5-log in@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newpg5-log in.imageset/UU_newpg5-log in@1x.png


TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newpg5-log in.imageset/UU_newpg5-log in@2x.png


TEMPAT SAMPAH
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/登录/UU_newpg5-log in.imageset/UU_newpg5-log in@3x.png


+ 10 - 2
UU_Ent/UU_Ent/Supporting Files/UU_Ent.pch

@@ -9,9 +9,17 @@
 #ifndef UU_Ent_pch
 #define UU_Ent_pch
 #import "common.h"
+#import "UIColor+HexColor.h"
+#import "UIButton+Layout.h"
+#import "YRButton.h"
 
-#import<Masonry/Masonry.h>
-#import<MJExtension/MJExtension.h>
+#import <Masonry/Masonry.h>
+#import <MJExtension/MJExtension.h>
+#import <IQKeyboardManager/IQKeyboardManager.h>
 #import "YRUserInfo.h"
 #import "YRTableView.h"
+
+#define self_width self.view.frame.size.width
+#define self_height self.view.frame.size.height
+#define HexColor(h) [UIColor colorWithHexString:(h)]
 #endif /* UU_Ent_pch */

+ 25 - 0
UU_Ent/UU_Ent/Utils/UIButton/UIButton+Layout.h

@@ -0,0 +1,25 @@
+//
+//  UIButton+Layout.h
+//  YBL365
+//
+//  Created by 乔同新 on 12/20/16.
+//  Copyright © 2016 乔同新. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface UIButton (Layout)
+
+@property (nonatomic,assign) CGRect titleRect;
+@property (nonatomic,assign) CGRect imageRect;
+
+- (void)setBackgroundColor:(UIColor *)backgroundColor
+                  forState:(UIControlState)state;
+
+@end
+
+@interface UIImage (colorful)
+
++ (UIImage *)imageWithColor:(UIColor *)color;
+
+@end

+ 115 - 0
UU_Ent/UU_Ent/Utils/UIButton/UIButton+Layout.m

@@ -0,0 +1,115 @@
+//
+//  UIButton+Layout.m
+//  YBL365
+//
+//  Created by 乔同新 on 12/20/16.
+//  Copyright © 2016 乔同新. All rights reserved.
+//
+
+#import "UIButton+Layout.h"
+#import <objc/runtime.h>
+
+@implementation UIButton (Layout)
+
+#pragma mark - ************* 通过运行时动态添加关联 ******************
+//定义关联的Key
+static const char * titleRectKey = "yl_titleRectKey";
+- (CGRect)titleRect {
+    
+    return [objc_getAssociatedObject(self, &titleRectKey) CGRectValue];
+}
+
+- (void)setTitleRect:(CGRect)rect {
+    
+    objc_setAssociatedObject(self, &titleRectKey, [NSValue valueWithCGRect:rect], OBJC_ASSOCIATION_RETAIN);
+}
+
+//定义关联的Key
+static const char * imageRectKey = "yl_imageRectKey";
+- (CGRect)imageRect {
+    
+    NSValue * rectValue = objc_getAssociatedObject(self, &imageRectKey);
+    
+    return [rectValue CGRectValue];
+}
+
+- (void)setImageRect:(CGRect)rect {
+    
+    objc_setAssociatedObject(self, &imageRectKey, [NSValue valueWithCGRect:rect], OBJC_ASSOCIATION_RETAIN);
+}
+
+#pragma mark - ************* 通过运行时动态替换方法 ******************
++ (void)load {
+    
+    MethodSwizzle(self,@selector(titleRectForContentRect:),@selector(override_titleRectForContentRect:));
+    MethodSwizzle(self,@selector(imageRectForContentRect:),@selector(override_imageRectForContentRect:));
+}
+
+void MethodSwizzle(Class c,SEL origSEL,SEL overrideSEL)
+{
+    
+    Method origMethod = class_getInstanceMethod(c, origSEL);
+    Method overrideMethod= class_getInstanceMethod(c, overrideSEL);
+    
+    //运行时函数class_addMethod 如果发现方法已经存在,会失败返回,也可以用来做检查用:
+    if(class_addMethod(c, origSEL, method_getImplementation(overrideMethod),method_getTypeEncoding(overrideMethod)))
+    {
+        //如果添加成功(在父类中重写的方法),再把目标类中的方法替换为旧有的实现:
+        class_replaceMethod(c,overrideSEL, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
+    }
+    else
+    {
+        //addMethod会让目标类的方法指向新的实现,使用replaceMethod再将新的方法指向原先的实现,这样就完成了交换操作。
+        method_exchangeImplementations(origMethod,overrideMethod);
+    }
+}
+
+- (CGRect)override_titleRectForContentRect:(CGRect)contentRect {
+    
+    if (!CGRectIsEmpty(self.titleRect) && !CGRectEqualToRect(self.titleRect, CGRectZero)) {
+        return self.titleRect;
+    }
+    return [self override_titleRectForContentRect:contentRect];
+    
+}
+
+- (CGRect)override_imageRectForContentRect:(CGRect)contentRect {
+    
+    if (!CGRectIsEmpty(self.imageRect) && !CGRectEqualToRect(self.imageRect, CGRectZero)) {
+        return self.imageRect;
+    }
+    return [self override_imageRectForContentRect:contentRect];
+}
+
+- (void)setTitleRect:(CGRect )titleRect ImageRect:(CGRect )imageRect {
+    
+    self.titleRect = titleRect;
+    self.imageRect = imageRect;
+}
+
+- (void)setBackgroundColor:(UIColor *)backgroundColor
+                  forState:(UIControlState)state {
+    
+    [self setBackgroundImage:[UIImage imageWithColor:backgroundColor] forState:state];
+}
+
+@end
+
+@implementation UIImage (colorful)
+
++ (UIImage *)imageWithColor:(UIColor *)color
+{
+    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
+    UIGraphicsBeginImageContext(rect.size);
+    CGContextRef context = UIGraphicsGetCurrentContext();
+    
+    CGContextSetFillColorWithColor(context, [color CGColor]);
+    CGContextFillRect(context, rect);
+    
+    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
+    UIGraphicsEndImageContext();
+    
+    return image;
+}
+
+@end

+ 25 - 0
UU_Ent/UU_Ent/Utils/UIButton/YRButton.h

@@ -0,0 +1,25 @@
+//
+//  YRButton.h
+//  UU_Ent
+//
+//  Created by huangyp-pc on 2019/4/30.
+//  Copyright © 2019 UAS. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface YRButton : UIButton
+
+/*按钮自定义参数*/
+@property (nonatomic,strong) NSString *toolStr;
+
+/**
+ title:按钮名字
+ color:字体颜色
+ nColor:按钮正常颜色
+ sColor:按钮点击颜色
+ dColor:按钮不可点击颜色
+ */
+-(id)initWithTitle:(NSString *)title titleColor:(UIColor *)color titleFont:(CGFloat)font buttonNormalColor:(UIColor *)nColor buttonSelectColor:(UIColor *)sColor buttonDiabledColor:(UIColor *)dColor;
+
+@end

+ 49 - 0
UU_Ent/UU_Ent/Utils/UIButton/YRButton.m

@@ -0,0 +1,49 @@
+//
+//  YRButton.m
+//  UU_Ent
+//
+//  Created by huangyp-pc on 2019/4/30.
+//  Copyright © 2019 UAS. All rights reserved.
+//
+
+#import "YRButton.h"
+
+@implementation YRButton
+
+-(id)initWithTitle:(NSString *)title titleColor:(UIColor *)color titleFont:(CGFloat)font buttonNormalColor:(UIColor *)nColor buttonSelectColor:(UIColor *)sColor buttonDiabledColor:(UIColor *)dColor{
+    if (self = [super init]) {
+        if (color) {
+            [self setTitleColor:color forState:UIControlStateNormal];
+        }else
+            [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+        
+        if (nColor) {
+            [self setBackgroundColor:color forState:UIControlStateNormal];
+        }else
+            [self setBackgroundColor:HexColor(@"#33A2EE") forState:UIControlStateNormal];
+        
+        if (sColor) {
+            [self setBackgroundColor:sColor forState:UIControlStateHighlighted];
+        }else
+            [self setBackgroundColor:HexColor(@"#2D84C0") forState:UIControlStateHighlighted];
+        
+        if (dColor) {
+            [self setBackgroundColor:dColor forState:UIControlStateDisabled];
+        }else
+            [self setBackgroundColor:HexColor(@"#8EB2CD") forState:UIControlStateDisabled];
+        
+        if (font) {
+            self.titleLabel.font = [UIFont systemFontOfSize:font];
+        }else
+            self.titleLabel.font = [UIFont systemFontOfSize:18];
+        
+        [self setTitle:title forState:UIControlStateNormal];
+        
+        self.layer.masksToBounds = YES;
+        
+        self.layer.cornerRadius = 5;
+    }
+    return self;
+}
+
+@end

+ 30 - 0
UU_Ent/UU_Ent/Utils/UIColor/UIColor+HexColor.h

@@ -0,0 +1,30 @@
+//
+//  UIColor+HexColor.h
+//  
+//
+//  Created by Jonas Schnelli on 01.07.10.
+//  Modified by Vladimir Boichentsov on 23.10.11.
+//  Copyright 2010 include7 AG. All rights reserved.
+//
+
+#ifndef _WOL_UICOLOR_HEX_COLOR_H__
+#define _WOL_UICOLOR_HEX_COLOR_H__
+
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+
+@interface UIColor (HexColor)
+
+- (NSString *) hexString;
+
++ (UIColor *) colorWithHex:(int)color;
++ (UIColor *) colorWithHexRed:(int)red green:(char)green blue:(char)blue alpha:(char)alpha;
+
++ (UIColor *) colorWithHexString:(NSString *)hexString;
++ (UIColor *) colorWithIntegerRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
+@end
+
+
+#endif

+ 92 - 0
UU_Ent/UU_Ent/Utils/UIColor/UIColor+HexColor.m

@@ -0,0 +1,92 @@
+//
+//  UIColor+HexColor.m
+//  
+//
+//  Created by Jonas Schnelli on 01.07.10.
+//  Modified by Vladimir Boichentsov on 23.10.11.
+//  Copyright 2010 include7 AG. All rights reserved.
+//
+
+#import "UIColor+HexColor.h"
+
+
+@implementation UIColor (i7HexColor)
+
+- (NSString *) hexString {
+	
+    const CGFloat *_color = CGColorGetComponents(self.CGColor);
+    NSString *hex = [NSString stringWithFormat:@"#%02X%02X%02X", (int)(_color[0]*255.0), (int)(_color[1]*255.0), (int)(_color[2]*255.0)];
+    
+    return hex;
+}
+
++ (UIColor *) colorWithHex:(int)color {
+
+    float red = (color & 0xff000000) >> 24;
+    float green = (color & 0x00ff0000) >> 16;
+    float blue = (color & 0x0000ff00) >> 8;
+    float alpha = (color & 0x000000ff);
+    
+    return [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:alpha/255.0];
+}
+
++ (UIColor *) colorWithHexRed:(int)red green:(char)green blue:(char)blue alpha:(char)alpha {
+    int x = 0;
+    x |= (red & 0xff) << 24;
+    x |= (green & 0xff) << 16;
+    x |= (blue & 0xff) << 8;
+    x |= (alpha & 0xff);
+    return [UIColor colorWithHex:x];
+}
+
+
++ (UIColor *) colorWithHexString:(NSString *)hexString {
+	
+	/* convert the string into a int */
+	unsigned int colorValueR,colorValueG,colorValueB,colorValueA;
+	NSString *hexStringCleared = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""];
+	if(hexStringCleared.length == 3) {
+		/* short color form */
+		/* im lazy, maybe you have a better idea to convert from #fff to #ffffff */
+		hexStringCleared = [NSString stringWithFormat:@"%@%@%@%@%@%@", [hexStringCleared substringWithRange:NSMakeRange(0, 1)],[hexStringCleared substringWithRange:NSMakeRange(0, 1)],
+												[hexStringCleared substringWithRange:NSMakeRange(1, 1)],[hexStringCleared substringWithRange:NSMakeRange(1, 1)],
+												[hexStringCleared substringWithRange:NSMakeRange(2, 1)],[hexStringCleared substringWithRange:NSMakeRange(2, 1)]];
+	}
+	if(hexStringCleared.length == 6) {
+		hexStringCleared = [hexStringCleared stringByAppendingString:@"ff"];
+	}
+	
+	/* im in hurry ;) */
+	NSString *red = [hexStringCleared substringWithRange:NSMakeRange(0, 2)];
+	NSString *green = [hexStringCleared substringWithRange:NSMakeRange(2, 2)];
+	NSString *blue = [hexStringCleared substringWithRange:NSMakeRange(4, 2)];
+	NSString *alpha = [hexStringCleared substringWithRange:NSMakeRange(6, 2)];
+	
+	[[NSScanner scannerWithString:red] scanHexInt:&colorValueR];
+	[[NSScanner scannerWithString:green] scanHexInt:&colorValueG];
+	[[NSScanner scannerWithString:blue] scanHexInt:&colorValueB];
+	[[NSScanner scannerWithString:alpha] scanHexInt:&colorValueA];
+	
+
+	return [UIColor colorWithRed:((colorValueR)&0xFF)/255.0 
+					green:((colorValueG)&0xFF)/255.0 
+					 blue:((colorValueB)&0xFF)/255.0 
+					alpha:((colorValueA)&0xFF)/255.0];
+	
+
+}
+
++ (UIColor *) colorWithIntegerRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha {
+
+    if (alpha > 1 ) {
+        alpha = alpha/255.f;
+    }
+    
+    return [UIColor colorWithRed:red/255.f
+                           green:green/255.f
+                            blue:blue/255.f
+                           alpha:alpha];
+}
+
+
+@end