详解iPhone应用中剪切技巧

移动开发 iOS
本文介绍的是详解iPhone应用中剪切技巧,主要介绍了iphone中的应用技巧,先来看详细内容。

详解iPhone应用剪切技巧是本文呢要介绍的内容,主要介绍了iphone中的应用技巧,内容不多,我们吸纳来看详细内容。iPhone应用中的剪切技巧列表。

1.获取图形上下文

2.构造剪切的路径(形状)

3.构建剪切区域

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. //创建一个基于位图的图形上下文并指定大小为CGSizeMake(200,400)  
  2. UIGraphicsBeginImageContext(CGSizeMake(200,400));   
  3.  
  4. //renderInContext 呈现接受者及其子范围到指定的上下文  
  5. [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];  
  6.      
  7.  //返回一个基于当前图形上下文的图片  
  8.  UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext();  
  9.    
  10.  //移除栈顶的基于当前位图的图形上下文  
  11. UIGraphicsEndImageContext();  
  12.  
  13. //以png格式返回指定图片的数据  
  14. imageData = UIImagePNGRepresentation(aImage); 

小结:详解iPhone应用剪切技巧的内容介绍完了,希望本文对你有所帮助。

责任编辑:zhaolei 来源: 博客园
相关推荐

2011-08-10 17:37:00

iPhoneASIHTTPRequ

2011-08-15 11:37:20

iPhone开发Mask

2011-08-12 14:33:06

iPhone缓存文件

2012-04-26 13:26:58

iPhone应用技巧

2011-08-09 14:08:51

iPhoneHTTP请求协议

2011-08-03 17:18:58

iPhone UILabel UISlider

2010-02-05 18:04:21

C++剪切板

2011-08-08 14:57:46

iPhone Autoreleas Property

2011-08-17 15:10:21

iPhone开发Web视图

2011-08-11 13:35:28

iPhoneASIHTTPRequHTTP

2011-08-19 14:14:14

iPhone应用

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-19 14:36:32

iPhone

2011-08-17 15:19:38

iPhone应用数据

2011-08-12 10:04:24

iPhone开发视图

2011-07-26 09:41:23

iPhone xcode Mac OS X

2011-08-02 17:14:41

iPhone应用 UITableVie

2009-12-10 16:45:39

Linux操作系统
点赞
收藏

51CTO技术栈公众号