iOS 输入框 UITextFiled 的一些简单设置
这个是自己做着玩的一个登录界面。这就是所有的代码,就是一个简单的使用。想做的更好的可以自己自定义一个输入框。
NSNumber * value = [NSNumber numberWithInteger:NSTextAlignmentCenter];
//手机号
_PhoneTF.layer.borderColor =[UIColor colorWithRed:245.0/255.0 green:255.0/255.0 blue:250.0/255.0 alpha:0.5].CGColor;
[_PhoneTF setValue:[UIColor colorWithRed:245.0/255.0 green:255.0/255.0 blue:250.0/255.0 alpha:0.5] forKeyPath:@"_placeholderLabel.textColor"];
[_PhoneTF setValue:value forKeyPath:@"_placeholderLabel.textAlignment"];
[_PhoneTF.layer setCornerRadius:18.0];
[_PhoneTF.layer setBorderWidth:1.0];
_PhoneTF.textAlignment = NSTextAlignmentCenter;
_PhoneTF.textColor= [UIColorwhiteColor];
_PhoneTF.keyboardType =UIKeyboardTypePhonePad;
//密码
_passWordTF.layer.borderColor =[UIColor colorWithRed:245.0/255.0 green:255.0/255.0 blue:250.0/255.0 alpha:0.5].CGColor;
[_passWordTF.layer setCornerRadius:18.0];
[_passWordTF.layer setBorderWidth:1.0];
[_passWordTF setValue:[UIColor colorWithRed:245.0/255.0 green:255.0/255.0 blue:250.0/255.0 alpha:0.5] forKeyPath:@"_placeholderLabel.textColor"];
[_passWordTF setValue:value forKeyPath:@"_placeholderLabel.textAlignment"];
_passWordTF.textColor= [UIColorwhiteColor];
_passWordTF.textAlignment = NSTextAlignmentCenter;
//登录按钮
[_LoginButton.layer setCornerRadius:18.0];
[_LoginButton.layer setBorderWidth:1.0];
_LoginButton.layer.borderColor =[UIColor clearColor].CGColor;