默认状态下TextField
字体是这个样子的
但是当切换到密文状态再切换回来之后,就变成了下面的样子
QQ20160603-1@2x.png
不知道为什么苹果默认在切换secure
状态是要改变TextField
的字体,其实在切换完secure状态变为非密文状态的时候默认给TextField
设置下字体就好可以解决了,大概就是这样
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UIButton *changeBtn;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.textField.font = [UIFont fontWithName:@"System" size:15];
}
- (IBAction)changeSecure:(id)sender {
self.textField.secureTextEntry = !self.textField.secureTextEntry;
self.textField.font = [UIFont fontWithName:@"System" size:15];
}
网友评论
self.passwordText.font = nil;
self.passwordText.font = [UIFont systemFontOfSize:12];
}
这样可能比较好一点