iPhone开发应用中抓图程序案例实现

移动开发 iOS
iPhone开发应用中抓图程序案例实现是本文要介绍的内容,主要是通过代码来实现抓图程序,具体实现过程,一起来看详细代码。

iPhone开发应用中抓图程序案例实现是本文要介绍的内容,主要是通过代码来实现抓图程序,具体实现过程,一起来看详细代码。

//获得屏幕图像  
- (UIImage *)imageFromView: (UIView *) theView    
{  
      
    UIGraphicsBeginImageContext(theView.frame.size);  
    CGContextRef context = UIGraphicsGetCurrentContext();  
    [theView.layer renderInContext:context];  
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();  
    UIGraphicsEndImageContext();  
      
    return theImage;  
}  
 
//获得某个范围内的屏幕图像  
- (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];  

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.

小结:iPhone开发应用中抓图程序案例实现的内容介绍完了,希望通过本文的学习能对你有所帮助!

责任编辑:zhaolei 来源: 互联网
相关推荐

2011-08-15 15:44:46

iPhone开发PDF

2011-08-18 16:24:44

iPhone开发图片

2011-08-17 16:12:20

iPhone应用程序

2011-08-19 11:10:31

iPhone应用

2011-08-19 10:13:05

iPhone开发

2011-08-18 15:24:40

iPhone国际化

2011-08-05 13:49:53

iPhone 应用 开发

2011-08-19 10:05:30

iPhone开发

2011-08-18 16:42:07

iPhone应用APNS推送

2011-08-15 11:23:41

iPhone开发循环滚动UIScrollVie

2011-08-15 18:02:32

iPhone开发表视图

2011-08-10 17:37:00

iPhoneASIHTTPRequ

2011-08-16 15:36:47

iPhone应用测试

2011-08-17 16:23:31

iPhone开发UIViewContr

2011-07-26 09:41:23

iPhone xcode Mac OS X

2010-08-27 10:41:41

iPhone核心应用程序

2011-08-12 14:54:45

iPhone委托

2011-07-26 11:13:15

iPhone PXL

2011-08-12 14:33:06

iPhone缓存文件

2011-08-09 17:12:30

iPhoneCFRunLoop
点赞
收藏

51CTO技术栈公众号