program problem
本文小白 有问题评论
1 block的内存释放问题
近期使用block处理键盘提交的问题 发现内存释放不了的问题
解决办法 添加 弱指针 __weak typeof (self) weakSelf = self;(防止循环饮用)
self.KeyView = [KeyView addKeyWithFrame:nil
placeText:@""
supeView:self.view
isKeyShow:nil
isShowViewController:self
withSubMitBlock:^(NSString *subMitString, NSMutableArray *imgSelectArray) {
weakSelf.subMitString = subMitString;
weakSelf.subMitArray = imgSelectArray;
weakSelf.list.userInteractionEnabled = NO;
weakSelf.subMitView = [[UIAlertView alloc] initWithTitle:nil message:@"!" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
weakSelf.subMitView show];}];
2.crash 问题 tableView
只能在iOS7以上使用的 上下滑动键盘收回 keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
3.正则表达式 筛选邮箱 电话号码
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@" , emailRegex];
return [emailTest evaluateWithObject:email];
NSString *phoneRegex = VALIDATEPHONE;
NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@" , phoneRegex];
return [phoneTest evaluateWithObject:phone];