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