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

Objective-C 截圖實現(xiàn)

移動開發(fā) iOS
本文為大家呈現(xiàn)了一個Objective-C的截圖實現(xiàn)的方法,希望大家能夠加以利用。

截取整個屏幕大小:

  1. UIGraphicsBeginImageContext(self.view.bounds.size); 
  2.         [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; 
  3.         UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext(); 
  4.         UIGraphicsEndImageContext(); 
  5.         UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil) 

截取自定義大?。?/p>

  1. UIGraphicsBeginImageContext(_attributedLabel.frame.size); 
  2.         [_attributedLabel.layer renderInContext:UIGraphicsGetCurrentContext()]; 
  3.         UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext(); 
  4.         UIGraphicsEndImageContext(); 
  5.         UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil); 

項目需要導入QuartzCore.framework

責任編輯:閆佳明 來源: oschina
相關(guān)推薦

2011-07-19 17:24:31

Objective-C 對象

2011-08-10 18:07:29

Objective-C反射

2013-03-27 12:54:00

iOS開發(fā)Objective-C

2011-05-11 11:20:26

Objective-C

2011-05-11 15:58:34

Objective-C

2013-03-26 10:35:47

Objective-C單例實現(xiàn)

2011-08-04 14:58:37

Objective-C Cocoa NSString

2011-08-02 13:16:36

Objective-C 語法 函數(shù)

2011-05-11 13:54:08

Objective-C

2011-05-11 15:45:50

內(nèi)存管理Objective-C

2013-08-21 14:57:42

objective-c問題

2011-05-11 14:06:49

Objective-C

2011-08-04 11:15:46

Objective-C 構(gòu)造函數(shù) 構(gòu)造方法

2014-04-30 10:16:04

Objective-CiOS語法

2011-08-03 16:55:05

Objective-C 代理

2011-07-08 13:49:46

Objective-C UUID

2011-07-29 16:16:30

Objective-c block

2011-08-04 09:35:09

Objective-C 編碼規(guī)范

2011-08-17 10:58:59

Objective-C構(gòu)造函數(shù)

2014-06-25 14:02:59

Objective-CKVO
點贊
收藏

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