默認狀態(tài)下TextField
字體是這個樣子的
QQ20160603-0@2x.png
但是當切換到密文狀態(tài)再切換回來之后允粤,就變成了下面的樣子
QQ20160603-1@2x.png
不知道為什么蘋果默認在切換secure
狀態(tài)是要改變TextField
的字體翼岁,其實在切換完secure狀態(tài)變?yōu)榉敲芪臓顟B(tài)的時候默認給TextField
設(shè)置下字體就好可以解決了,大概就是這樣
@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];
}