Ios 如何设置字体颜色?
下面的代码正在将文本绘制到图像上,但它是黑色的,我需要更改颜色。有什么建议吗Ios 如何设置字体颜色?,ios,Ios,下面的代码正在将文本绘制到图像上,但它是黑色的,我需要更改颜色。有什么建议吗 UIFont* font = [UIFont systemFontOfSize:250]; NSDictionary *attributes = @{NSFontAttributeName: font}; CGSize size = [WmarText sizeWithAttributes:attributes]; // Create a bitmap context into which the text will
UIFont* font = [UIFont systemFontOfSize:250];
NSDictionary *attributes = @{NSFontAttributeName: font};
CGSize size = [WmarText sizeWithAttributes:attributes];
// Create a bitmap context into which the text will be rendered.
UIGraphicsBeginImageContext(size);
// Render the text
[[UIColor whiteColor] setFill];
[WmarText drawAtPoint:CGPointMake(0, 0) withAttributes:attributes];
将带有[UIColor whiteColor]的NSForegroundColorAttributeName添加到属性字典。请参见将带有[UIColor whiteColor]的NSForegroundColorAttributeName添加到属性字典。请参见将带有[UIColor whiteColor]的NSForegroundColorAttributeName添加到属性字典。请参见将带有[UIColor whiteColor]的NSForegroundColorAttributeName添加到属性字典。请参见是否尝试在属性变量中设置颜色?像这样:
NSDictionary *attributes = @{ NSFontAttributeName: font,
NSForegroundColorAttributeName: [UIColor whiteColor]};
我想这就成功了。您是否尝试过在attributes变量中设置颜色?像这样:
NSDictionary *attributes = @{ NSFontAttributeName: font,
NSForegroundColorAttributeName: [UIColor whiteColor]};
我想这就成功了。您是否尝试过在attributes变量中设置颜色?像这样:
NSDictionary *attributes = @{ NSFontAttributeName: font,
NSForegroundColorAttributeName: [UIColor whiteColor]};
我想这就成功了。您是否尝试过在attributes变量中设置颜色?像这样:
NSDictionary *attributes = @{ NSFontAttributeName: font,
NSForegroundColorAttributeName: [UIColor whiteColor]};
我想这就是关键所在。再加上:
NSForegroundColorAttributeName: [UIColor whiteColor]
在属性中添加以下内容:
NSForegroundColorAttributeName: [UIColor whiteColor]
在属性中添加以下内容:
NSForegroundColorAttributeName: [UIColor whiteColor]
在属性中添加以下内容:
NSForegroundColorAttributeName: [UIColor whiteColor]
进入你的属性