0
,我需要用我的UIGraphicsBeginImageContextWithOptions要求開始從-20從產地捕捉圖像的-20從產地與iPhone的SDK UIGraphicsBeginImageContextWithOptions
任何幫助,將不勝感激
,我需要用我的UIGraphicsBeginImageContextWithOptions要求開始從-20從產地捕捉圖像的-20從產地與iPhone的SDK UIGraphicsBeginImageContextWithOptions
任何幫助,將不勝感激
使用下列拍攝拍攝圖像代碼和導入<QuartzCore/QuartzCore.h>
。您也可以在拍攝圖像後使用此代碼。所以你可以從中刪除不必要的部分。
UIGraphicsBeginImageContext(self.view.frame.size);
//or
UIGraphicsBeginImageContextWithOptions(self.view.frame.size, NO, 0.0);//this will also give you scaling option and more better for resolution.
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
CGImageRef ref = viewImage.CGImage;
CGRect myImageArea = CGRectMake (20, 20,
300, 100);// you define coordinates according your requirements.
CGImageRef mySubimage = CGImageCreateWithImageInRect (ref, myImageArea);
UIImage *yourfinalcapturedimage = [UIImage imageWithCGImage:mySubimage];// this will give you your required image.
希望,這將幫助你..