自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

詳解iPhone應(yīng)用中剪切技巧

移動開發(fā) iOS
本文介紹的是詳解iPhone應(yīng)用中剪切技巧,主要介紹了iphone中的應(yīng)用技巧,先來看詳細(xì)內(nèi)容。

詳解iPhone應(yīng)用剪切技巧是本文呢要介紹的內(nèi)容,主要介紹了iphone中的應(yīng)用技巧,內(nèi)容不多,我們吸納來看詳細(xì)內(nèi)容。iPhone應(yīng)用中的剪切技巧列表。

1.獲取圖形上下文

2.構(gòu)造剪切的路徑(形狀)

3.構(gòu)建剪切區(qū)域

4.貼上你的畫 

  1. // 1CGContextRef context = UIGraphicsGetCurrentContext();  
  2. // 2CGRect bounds = CGRectMake(0.0f, 0.0f, SIDELENGTH, SIDELENGTH);  
  3.  
  4. CGMutablePathRef path = CGPathCreateMutable();CGPathAddEllipseInRect(path, NULL, bounds);  
  5. // 3CGContextAddPath(context, path);CGContextClip(context);  
  6. // 4[LOGO drawInRect:bounds]; 

截取屏幕圖片

  1. //創(chuàng)建一個基于位圖的圖形上下文并指定大小為CGSizeMake(200,400)  
  2. UIGraphicsBeginImageContext(CGSizeMake(200,400));   
  3.  
  4. //renderInContext 呈現(xiàn)接受者及其子范圍到指定的上下文  
  5. [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];  
  6.      
  7.  //返回一個基于當(dāng)前圖形上下文的圖片  
  8.  UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext();  
  9.    
  10.  //移除棧頂?shù)幕诋?dāng)前位圖的圖形上下文  
  11. UIGraphicsEndImageContext();  
  12.  
  13. //以png格式返回指定圖片的數(shù)據(jù)  
  14. imageData = UIImagePNGRepresentation(aImage); 

小結(jié):詳解iPhone應(yīng)用剪切技巧的內(nèi)容介紹完了,希望本文對你有所幫助。

責(zé)任編輯:zhaolei 來源: 博客園
相關(guān)推薦

2011-08-10 17:37:00

iPhoneASIHTTPRequ

2011-08-12 14:33:06

iPhone緩存文件

2011-08-15 11:37:20

iPhone開發(fā)Mask

2011-08-09 14:08:51

iPhoneHTTP請求協(xié)議

2011-08-03 17:18:58

iPhone UILabel UISlider

2012-04-26 13:26:58

iPhone應(yīng)用技巧

2011-08-08 14:57:46

iPhone Autoreleas Property

2010-02-05 18:04:21

C++剪切板

2011-08-11 13:35:28

iPhoneASIHTTPRequHTTP

2011-08-17 15:10:21

iPhone開發(fā)Web視圖

2011-08-19 14:14:14

iPhone應(yīng)用

2010-02-22 11:25:50

WCF DateSet

2011-07-27 11:14:37

iPhone UITableVie

2011-07-08 17:45:19

iPhone 文檔

2011-07-26 09:41:23

iPhone xcode Mac OS X

2011-08-12 10:04:24

iPhone開發(fā)視圖

2011-08-17 15:19:38

iPhone應(yīng)用數(shù)據(jù)

2011-07-19 14:36:32

iPhone

2009-12-10 16:45:39

Linux操作系統(tǒng)

2011-08-02 17:14:41

iPhone應(yīng)用 UITableVie
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號