[英]Extract image of UISegmentedControl on iPhone
I am using UISegmentedControl
(with only one segment) as a button. 我正在使用
UISegmentedControl
(只有一个细分)作为按钮。 But problem with this is one cannot change font size in UISegmentedControl
(possible in iOS-5+ but I am targeting lower versions devices). 但这是一个问题,无法更改
UISegmentedControl
字体大小(可能在iOS-5 +中,但我的目标是较低版本的设备)。 Is it possible to extract image of UISegmentedControl
from app so that I can use custom UIButton
with this image as background? 是否可以从应用程序提取
UISegmentedControl
图像,以便我可以将自定义UIButton
与此图像用作背景?
Any help will be appreciated. 任何帮助将不胜感激。
尝试UIKit-Artwork-Extractor(在github.com上查找)
for (UIImageView*imgView in segmentControl.subviews) {
UIGraphicsBeginImageContext(imgView.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[segmentControl.layer renderInContext:context];
UIImage *yourImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
and import QuartzCore.framework 并导入QuartzCore.framework
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.