-(void)viewDidLoad
{
self.specialStringArray = [@[] mutableCopy];
NSString * string = @"~,¥,#,&,*,<,>,《,》,(,),[,],{,},【,】,^,@,/,£,¤,,|,§,¨,「,」,『,』,¢,¬, ̄,(,),——,+,|,$,_,€,¥";
self.specialStringArray = [string componentsSeparatedByString:@","];
}];
//在需要的地方调用该方法
-(void)submit
{
NSString * intriduction = self.textField.text;
for (NSInteger i = 0; i < self.specialStringArray.count; i ++) {
//判断字符串中是否含有特殊符号
if ([intriduction rangeOfString:self.specialStringArray[i]].location != NSNotFound) {
[MyUtil showTipText:@"请不要输入特殊符号" completion:^{
[self.textVew becomeFirstResponder];
}];
return;
}
}
}
网友评论