UITextfield的一些属性
2016-04-06 20:28
477 查看
//设置左视图 不用设置frame
UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"phoneIcon@x"]];
self.infoText.leftView = imageV;
self.infoText.leftViewMode = UITextFieldViewModeAlways;
//如果是button带点击事件 不设置frame 视图不能上显示
self.secureBtn = [UIButton buttonWithType:UIButtonTypeSystem];
self.secureBtn.frame = CGRectMake(0, 0, self.pwdText.width / 8, self.pwdText.height);
[self.secureBtn setBackgroundImage:[UIImage imageNamed:@"btn_password_hidden@3x"] forState:UIControlStateNormal];
[self.secureBtn addTarget:self action:@selector(hiden) forControlEvents:UIControlEventTouchUpInside];
self.pwdText.rightView = self.secureBtn;
self.pwdText.rightViewMode = UITextFieldViewModeAlways;
//设置占位符 颜色默认
self.pwdText.Placeholder = @"请输入密码";
//设置占位符的颜色
self.pwdText.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入密码" attributes:
//设置是否是一次性清除按钮
self.infoText.clearButtonMode = YES;//设置
//设置是否隐藏密码
self.pwdText.secureTextEntry = YES ;//隐藏
UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"phoneIcon@x"]];
self.infoText.leftView = imageV;
self.infoText.leftViewMode = UITextFieldViewModeAlways;
//如果是button带点击事件 不设置frame 视图不能上显示
self.secureBtn = [UIButton buttonWithType:UIButtonTypeSystem];
self.secureBtn.frame = CGRectMake(0, 0, self.pwdText.width / 8, self.pwdText.height);
[self.secureBtn setBackgroundImage:[UIImage imageNamed:@"btn_password_hidden@3x"] forState:UIControlStateNormal];
[self.secureBtn addTarget:self action:@selector(hiden) forControlEvents:UIControlEventTouchUpInside];
self.pwdText.rightView = self.secureBtn;
self.pwdText.rightViewMode = UITextFieldViewModeAlways;
//设置占位符 颜色默认
self.pwdText.Placeholder = @"请输入密码";
//设置占位符的颜色
self.pwdText.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入密码" attributes:
//设置是否是一次性清除按钮
self.infoText.clearButtonMode = YES;//设置
//设置是否隐藏密码
self.pwdText.secureTextEntry = YES ;//隐藏
相关文章推荐
- a mirror of Android build ENV setup flow
- ANDROID 中UID与PID的作用与区别
- iOS开发中关于多线程的问题(NSOperationQueue,NSThread,GCD)
- UIImage 加载性能优化
- SetBkMode可设置文字背景色:TRANSPARENT或OPAQUE
- Xamarin.iOS + MvvmCross: UIPickerView data binding, SelectedItemChanged event
- POJ 2524-Ubiquitous Religions(入门并查集)
- iOS——UIPickerView UIDatePicker使用
- UIUIControlEvents的几种类型值
- UI中 用单例的方法进行屏幕支配,由相对位置得到确定视图位置
- GXPT(一)——UI设计
- Android自定义UI属性样式
- Quick_触摸事件
- iOS UIDevice- NSBundle - NSlocale
- mysql Field xxx doesn't have a default value STRICT_TRANS_TABLES(存储引擎启用严格模式,非法数据值被拒绝)
- UITableViewCell 设置圆角
- 杭电 3177 Crixalis's Equipment
- 【poj 1699】Best Sequence 题意&题解&代码(C++)
- [poj 1699] Best Sequence dfs+剪支
- 随笔-uint8_t / uint16_t / uint32_t /uint64_t 是什么数据类型 - 大总结,看完全明白了