iOS截图功能
-(UIImage *)captureScreenWithRect:(CGRect)rect{
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, YES, 1);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIImage *resultImg = [UIImage imageWithCGImage:CGImageCreateWithImageInRect(img.CGImage, rect)];
UIGraphicsEndImageContext();
return resultImg;
}