我们可以将Font设置为字符串吗?

发布于 2024-12-16 23:00:53 字数 84 浏览 1 评论 0原文

一般在xcode编程中,我们可以设置Font、Labels、TextFields等等。 那么我们可以用同样的方式将字体设置为字符串(NSString)吗?

Generally in the xcode programming, we can set Font to Labels,TextFields and many more.
Well in the same way can we set font to a string(NSString)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

Hello爱情风 2024-12-23 23:00:53

不 - NSString 只是一个字符串。您看到的是字符串的表示。而且,这与实际的字符串是分开的。就像 NSDate 只是一个日期一样,但是您呈现它的方式是通过 NSDateFormatter

您正在寻找的是 NSAttributedString 类。

No - An NSString is just, well, a string. What you are looking at is the presentation of a string. And, this is separate from the actual string. In the same way that NSDate is just a date, but the way you present it is through an NSDateFormatter.

What you are looking for is the NSAttributedString class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文