【问题标题】:Swift, is it possible to use SF Symbols in Navigation Bar title?Swift,是否可以在导航栏标题中使用 SF 符号?
【发布时间】:2020-10-25 19:13:13
【问题描述】:

想知道如何使用 SF 符号作为视图控制器标题。有可能吗?

    viewController.title = [somehow want to use an SF Symbol here]

【问题讨论】:

  • 你自己试试看能不能,相当容易测试

标签: ios swift xcode uinavigationcontroller titlebar


【解决方案1】:

是的,你可以使用 imageView 和 SFSymbol 来做到这一点

let imageView = UIImageView(image: UIImage(systemName: "gear"))
        imageView.contentMode = .scaleAspectFit
        imageView.clipsToBounds = true
        navigationItem.titleView = imageView

【讨论】:

    猜你喜欢
    • 2019-09-23
    • 1970-01-01
    • 1970-01-01
    • 2020-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-28
    相关资源
    最近更新 更多