很多時(shí)候我們需要保證用戶輸入的內(nèi)容是漢字,這個(gè)時(shí)候需要判斷用戶輸入的內(nèi)容
//如果輸入的內(nèi)容是字母,判斷是否合格? ? ? ?
?if(self.nickNameText){? ? ? ? ? ??
for (int i=0; i8){
UIAlertView *alertView=[[UIAlertViewalloc]initWithTitle:@"不要輸入低于2個(gè)或者高于8個(gè)" message:@"您輸入的內(nèi)容格式有誤,請(qǐng)重新輸入" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"確定",nil];
[alertView show];
return;
}
}else if(strlen(cString)==1)
{
NSLog(@"內(nèi)容是字母");
if(self.nickNameText.length<4||self.nickNameText.length>16){
UIAlertView *alertView=[[UIAlertViewalloc]initWithTitle:@"不要輸入低于4個(gè)或者高于16個(gè)" message:@"您輸入的內(nèi)容格式有誤"delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"確定", nil];
[alertView show];
return;
}
}
}
}