【问题标题】:How to add Font with inner color and outer color [closed]如何添加具有内部颜色和外部颜色的字体[关闭]
【发布时间】:2018-06-14 09:11:37
【问题描述】:

我正在开发 ios swift 4 中的照片编辑应用程序,我想提供如下功能

如图所示,我想为 Text 提供内部颜色和外部颜色。但我对此一无所知。我怎样才能实现它是否有任何函数库

我尝试了一些字体属性,因为我使用了阴影颜色和背景颜色,但它不符合我的要求。 请帮忙!

【问题讨论】:

  • 您是要我们为您创建一个在线 Photoshop 应用程序还是我只是误读了?
  • @xoxel 我正在 ios swfit 4 中创建应用程序

标签: ios swift text fonts uicolor


【解决方案1】:

您可以使用NSAttributedString 实现这种功能:

NSAttributedString(string: "Testing", attributes: [
.foregroundColor: #colorLiteral(red: 0.980392158, green: 0.5607843399, blue: 0, alpha: 1),
.strokeColor: #colorLiteral(red: 0.03990633413, green: 0.1469032466, blue: 0.7415332794, alpha: 1),
.strokeWidth: -3,
.font: UIFont.systemFont(ofSize: 30)])

这会产生一个如下所示的字符串:

【讨论】:

  • 它有效,谢谢:)
猜你喜欢
  • 2013-10-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-04-25
  • 1970-01-01
  • 1970-01-01
  • 2020-12-13
相关资源
最近更新 更多