截取当前屏幕
-(UIImage*)imageFromView : (UIView*)view
{
UIGraphicsBeginImageContext(CGSizeMake(appWith,appHight-50));
//renderInContext呈现接受者及其子范围到指定的上下文
[view.layerrenderInContext:UIGraphicsGetCurrentContext()];
//返回一个基于当前图形上下文的图片
UIImage*extractImage =UIGraphicsGetImageFromCurrentImageContext();
//移除栈顶的基于当前位图的图形上下文
UIGraphicsEndImageContext();
//以png格式返回指定图片的数据
NSData*imageData =UIImagePNGRepresentation(extractImage);
UIImage*imge = [UIImageimageWithData:imageData];
----------------------------------至此已经得到需要的图片------------------------------------------
//根据自己的需要编辑尺寸
floatoriginX =0.0;
floatoriginY =0.0;
floatwidth =appWith;
floatheight =450;
CGRectrect1 =CGRectMake(originX , originY, width ,height);
UIImage* Scrimg = [UIImageimageWithCGImage:CGImageCreateWithImageInRect([imgeCGImage], rect1)];
returnScrimg;
}