1.判断邮箱格式
-(BOOL)isValidateEmail:(NSString *)email
{
NSString *emailRegex [email protected]"[A-Z0-9a-z._%+-][email protected][A-Za-
z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate
predicateWithFormat:@"SELF MATCHES%@",emailRegex];
return[emailTest evaluateWithObject:email];
}
2.图片压缩
UIImage *yourImage= [selfimageWithImageSimple:image
scaledToSize:CGSizeMake(210.0, 210.0)];
- (UIImage*)imageWithImageSimple:(UIImage*)image
scaledToSize:(CGSize)newSize
{
Tell the old image to draw in this newcontext, with
the desired
new size
[image
drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
Get the new image from the context
UIImage* newImage =
UIGraphicsGetImageFromCurrentImageContext();
Create a graphics image context
UIGraphicsBeginImageContext(newSize);
End the context
UIGraphicsEndImageContext();
Return the new image.
returnnewImage;
}