【问题标题】:UISearchbar squished in UINavigationbarUISearchbar 在 UINavigationbar 中被压扁
【发布时间】:2018-05-12 13:35:17
【问题描述】:

我在导航栏中设置了一个搜索栏作为标题视图。在初始视图中,搜索栏在中间均匀分布,两侧有按钮。在此视图中,后退按钮推动搜索栏,使其不均匀。我已经尝试摆脱后退按钮的文本,但仍然无法将搜索栏展开。 Squished search bar image

【问题讨论】:

    标签: ios swift uinavigationcontroller uisearchbar


    【解决方案1】:

    我最近需要解决同样的问题。我最终创建了一个带有后退按钮图像资产的 UIBarButtonItem,并将其设置为navigationItem.leftBarButtonItem。按下此按钮然后调用navigationController?.popViewController(animated: true) 将视图控制器从堆栈中弹出

    【讨论】:

    • 我会试试的。没有提供返回按钮图片吗?
    • 它对我有用!为了获得图像,我去了developer.apple.com/design/resources 并下载了 Sketch 的资源,然后找到了后退图标并将其导入到我的项目中。
    猜你喜欢
    • 1970-01-01
    • 2022-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-03
    • 2021-06-24
    相关资源
    最近更新 更多