码迷,mamicode.com
首页 > 其他好文 > 详细

判断邮箱格式和图片压缩

时间:2016-11-17 00:43:22      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:orm   reg   lua   rom   validate   uri   bool   win   form   

1.判断邮箱格式

-(BOOL)isValidateEmail:(NSString *)email

{

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];

}

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;

}

判断邮箱格式和图片压缩

标签:orm   reg   lua   rom   validate   uri   bool   win   form   

原文地址:http://www.cnblogs.com/CJH5209/p/6072148.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!