目前在学coreText绘制,为什么绘制的区域的背景色是黑色,怎么设置背景色?
来源:互联网 发布:云计算 搭建 openstack 编辑:程序博客网 时间:2024/04/30 05:50
目前在学coreText绘制,为什么绘制的区域的背景色是黑色 ?
尝试很多方法都没法改变绘制区的背景色,求指点。
#import "TXTCView.h"
@implementation TXTCView
- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];
self.backgroundColor = [UIColor whiteColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGMutablePathRef path = CGPathCreateMutable();//1
CGPathAddRect(path, NULL, self.bounds);
NSAttributedString * attString = [[NSAttributedString alloc] initWithString:@"Hello core text World!!"];
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attString);
CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, [attString length]), path, NULL);
CTFrameDraw(frame, context);//4
CFRelease(frame);//5
CFRelease(path);
CFRelease(framesetter);
}
尝试很多方法都没法改变绘制区的背景色,求指点。
#import "TXTCView.h"
@implementation TXTCView
- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];
self.backgroundColor = [UIColor whiteColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGMutablePathRef path = CGPathCreateMutable();//1
CGPathAddRect(path, NULL, self.bounds);
NSAttributedString * attString = [[NSAttributedString alloc] initWithString:@"Hello core text World!!"];
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attString);
CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, [attString length]), path, NULL);
CTFrameDraw(frame, context);//4
CFRelease(frame);//5
CFRelease(path);
CFRelease(framesetter);
}
0 0
- 目前在学coreText绘制,为什么绘制的区域的背景色是黑色,怎么设置背景色?
- IOS 绘制背景色渐变的矩形
- IOS 绘制背景色渐变的矩形
- IOS 绘制背景色渐变的矩形
- MFC OnPaint某一区域绘制背景色
- 绘制渐变背景色
- iOS UITableViewHeaderFooterView的背景色怎么设置?
- 怎么设置dos框的背景色和前景色~
- 设置标题栏背景色,背景色是自定义背景色
- 使用XML取消标题时的背景色为什么是黑色
- 怎么把android模拟器的背景色设置默认为黑色
- notepad++ 设置编辑区域背景色为黑色
- 对话框背景色的设置
- 对话框背景色的设置
- 对话框背景色的设置
- 设置对话框的背景色
- TabContainer 背景色的设置
- LinearLayout的背景色设置
- vysor原理以及Android同屏方案
- gitlab 仓库存放地址
- 获取资源文件的3种方式
- dbcp连接池错误Failed to validate a poolable connection. java.sql.SQLException:
- Scala学习整理[第四-六章 使用Scala运行类/对象]<Programming In Scala>
- 目前在学coreText绘制,为什么绘制的区域的背景色是黑色,怎么设置背景色?
- dwz框架解读
- view的刷新机制
- Android IPC机制(二)用Messenger进行进程间通信
- GTK+和C语言实现的哈夫曼文件压缩工具
- jQuery性能优化的28个建议
- Mac开发中,请问如何编码实现操作finder打开指定目录,谢谢!
- Spark SQL 之 DataFrame
- BZOJ2091: [Poi2010]The Minima Game