开发者

allow only to enter english characters in iPhone UITextField

开发者 https://www.devze.com 2022-12-23 16:40 出处:网络
I want to allow user to enter only english alphabets and characters. How can i prevent user from entering other charact开发者_如何学Pythoners than english.Check out UIKeyboardType - there is an option

I want to allow user to enter only english alphabets and characters. How can i prevent user from entering other charact开发者_如何学Pythoners than english.


Check out UIKeyboardType - there is an option to support only ASCII (UIKeyboardTypeASCIICapable).

Also, there are options in the UITextFieldDelegate protocol that could allow you to selectively filter input. Take a look at:

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号