gpt4 book ai didi

ios - 如何设置字体颜色?

转载 作者:行者123 更新时间:2023-11-28 20:03:52 25 4
gpt4 key购买 nike

下面的代码正在努力将文本绘制到图像上,但它是黑色的,我需要更改颜色。有什么建议吗?

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];

最佳答案

您是否尝试过在属性变量中设置颜色?像这样:

NSDictionary *attributes = @{ NSFontAttributeName: font,
NSForegroundColorAttributeName: [UIColor whiteColor]};

我认为这可以解决问题。

关于ios - 如何设置字体颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22815014/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com