我在界面生成器中生成了幾個文本字段,然後編寫了一些文本字段。佔位符文本似乎有不同的大小。看來我應該能夠獲得相同的字體,而無需繼承UITextField。我只是試圖重新創建一個看起來像界面生成器的文本框。UITextField佔位符具有不同的字體大小
UITextField *textField = [[UITextField alloc] init];
textField.placeholder = string;
[textField setTranslatesAutoresizingMaskIntoConstraints:NO];
[textField setBorderStyle:UITextBorderStyleRoundedRect];
[self.view addSubview:textField];
textField.returnKeyType = UIReturnKeyNext;
textField.inputAccessoryView = [[QEDCKeyboardAccessory alloc] initWithDelegate:self];
textField.delegate = self;
那麼你的問題是什麼呢? –
您可以在代碼中設置textfield fontsize。 – payal
你可以發佈你用來創建textField的代碼嗎? –