iPhone開發(fā)應(yīng)用中抓圖程序案例實(shí)現(xiàn)
作者:佚名 
  iPhone開發(fā)應(yīng)用中抓圖程序案例實(shí)現(xiàn)是本文要介紹的內(nèi)容,主要是通過代碼來實(shí)現(xiàn)抓圖程序,具體實(shí)現(xiàn)過程,一起來看詳細(xì)代碼。
 iPhone開發(fā)應(yīng)用中抓圖程序案例實(shí)現(xiàn)是本文要介紹的內(nèi)容,主要是通過代碼來實(shí)現(xiàn)抓圖程序,具體實(shí)現(xiàn)過程,一起來看詳細(xì)代碼。
- //獲得屏幕圖像
 - - (UIImage *)imageFromView: (UIView *) theView
 - {
 - UIGraphicsBeginImageContext(theView.frame.size);
 - CGContextRef context = UIGraphicsGetCurrentContext();
 - [theView.layer renderInContext:context];
 - UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
 - UIGraphicsEndImageContext();
 - return theImage;
 - }
 - //獲得某個(gè)范圍內(nèi)的屏幕圖像
 - - (UIImage *)imageFromView: (UIView *) theView atFrame:(CGRect)r
 - {
 - UIGraphicsBeginImageContext(theView.frame.size);
 - CGContextRef context = UIGraphicsGetCurrentContext();
 - CGContextSaveGState(context);
 - UIRectClip(r);
 - [theView.layer renderInContext:context];
 - UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
 - UIGraphicsEndImageContext();
 - return theImage;//[self getImageAreaFromImage:theImage atFrame:r];
 - }
 
小結(jié):iPhone開發(fā)應(yīng)用中抓圖程序案例實(shí)現(xiàn)的內(nèi)容介紹完了,希望通過本文的學(xué)習(xí)能對你有所幫助!
責(zé)任編輯:zhaolei 
                    來源:
                    互聯(lián)網(wǎng)
 














 
 
 
 
 
 
 