// 把一个View视图转换为Image
-(UIImage *)getImageFromView
{
UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 44)];
redView.backgroundColor = [UIColor redColor];
//UIGraphicsBeginImageContext(theView.bounds.size);
UIGraphicsBeginImageContextWithOptions(redView.bounds.size, YES, redView.layer.contentsScale);
[redView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}