开发者

Capture UIImageView context

开发者 https://www.devze.com 2023-02-02 02:39 出处:网络
I am trying capture开发者_高级运维 UIIMage with UIGraphicsBeginImageContext(); but my code capture the whole screen then save it into photo library ...

I am trying capture开发者_高级运维 UIIMage with UIGraphicsBeginImageContext(); but my code capture the whole screen then save it into photo library ...

UIGraphicsBeginImageContext(self.view.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIImageWriteToSavedPhotosAlbum(screenshot, nil, nil, nil);
UIGraphicsEndImageContext();

I just want capture my UIImageView things on it ! ... any suggest ?


Found it ! :

UIGraphicsBeginImageContext(image.bounds.size); [image.layer renderInContext:UIGraphicsGetCurrentContext()];

0

精彩评论

暂无评论...
验证码 换一张
取 消