iOS-手机屏幕截屏(截屏不包括状态栏)

UIGraphicsBeginImageContextWithOptions(CGSizeMake(self.view.frame.size.width, self.view.frame.size.height), YES, 0);

[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *uiImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

CGImageRef imageRef = uiImage.CGImage;

UIImage *sendImage = [[UIImage alloc] initWithCGImage:imageRef];

self.myImg.image = sendImage;

你可能感兴趣的:(iOS-手机屏幕截屏(截屏不包括状态栏))