Tôi muốn thay đổi loại bàn phím từ mặc định thành số sau khi người dùng nhấn nút quay lại. Tuy nhiên sau khi thiết lập thuộc tính keyboardType, không có gì xảy ra.Loại bàn phím thay đổi theo lập trình trên iOS không có gì
Mã của tôi:
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField setKeyboardType:UIKeyboardTypeNumbersAndPunctuation];
return YES;
}
tôi đã đặt ra cho mình là lĩnh vực văn bản đại biểu và phương pháp đang được gọi sau khi nhấn nút trở lại.
EDIT: Solved bởi
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField setKeyboardType:UIKeyboardTypeNumbersAndPunctuation];
[textField reloadInputViews];
return YES;
}
http://stackoverflow.com/questions/7301018/programmatically-change-uitextfield-keyboard-type – Rushabh
Bạn có thể muốn thử giải pháp được đăng trong câu hỏi này: http://stackoverflow.com/questions/1594346/dynamically-changing-keyboard-type-for-a-uisearchbar – henning77