?截取當前屏幕
-(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;
}