有无论如何,我可以允许用户在文本视图中只输入字母数字字符,没有其他字符。只允许在UITextView中的字母数字字符
编辑:
试过,
if ([_txtView.text rangeOfCharacterFromSet:alphaSet].location != NSNotFound)
{
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Hello" message:@"Only alpha numeric characters are allowed" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
return;
}
,但这只适用于某些时代
谢谢!
如果章程不是字母数字,则在“shouldChangeCharactersInRange”方法中返回NO。 – user1113101 2013-04-22 12:37:10