/*=====================================================================================spa
string就是此時輸入的那個字符textField就是此時正在輸入的那個輸入框返回YES就是能夠改變輸入框的值NO相反3d
=====================================================================================*/ci
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)stringstring
{it
//獲得輸入框的內容im
NSString * toBeString = [textField.text stringByReplacingCharactersInRange:range withString:string]; margin
if (self.myTextFieldPhone == textField)//判斷是否時咱們想要限定的那個輸入框touch
{top
if ([toBeString length] > 11)//若是輸入框內容大於11img
{
textField.text = [toBeString substringToIndex:11];
[self touchesBegan:nil withEvent:nil];
return NO;
}
}
self.myTextFieldEmail.keyboardType = UIKeyboardTypeNamePhonePad;
return YES;
}