Re: [問題] UIView特定範圍截圖
本來想把這個方法用在tableView上面
結果好像沒辦法
請問該怎麼截取連續的cells
(cells的個數不限
所以有可能超出螢幕
例如:截取一整個section的cells)
: 想在UIView上特定區城的做截圖
:
: UIGraphicsBeginImageContextWithOptions(CGSizeMake(200, 200), self.view.opaque, self.view.contentScaleFactor);
: CGContextRef context = UIGraphicsGetCurrentContext();
: [self.view.layer renderInContext:context];
: UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
: UIGraphicsEndImageContext();
:
: 自問自答
:
: 把上面的第一行改成UIView的size
:
: UIGraphicsBeginImageContextWithOptions(self.view.bounds.size,
: self.view.opaque,
: self.view.contentScaleFactor);
: 先把UIView轉成UIImage
: 最後再用CGImageCreateWithImageInRect截圖
: CGImageRef shotImageRef = CGImageCreateWithImageInRect(image.CGImage,
: CGRectMake(200, 200, 100, 100));
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 1.160.26.73
推
10/18 17:22, , 1F
10/18 17:22, 1F
→
10/19 19:41, , 2F
10/19 19:41, 2F
→
10/19 19:42, , 3F
10/19 19:42, 3F
→
10/19 19:43, , 4F
10/19 19:43, 4F
→
10/21 13:23, , 5F
10/21 13:23, 5F
→
10/22 09:56, , 6F
10/22 09:56, 6F
討論串 (同標題文章)
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章