【问题标题】:UISearchBar custom background issueUISearchBar 自定义背景问题
【发布时间】:2016-01-22 22:03:10
【问题描述】:

我在为 UISearchBar 设置自定义背景时遇到问题。 UISearchBar 被添加为 UITableView 的标题。对于设置背景,我使用下一行:

UISearchBar.appearance().setSearchFieldBackgroundImage(UIImage(named: "search_field"), forState: .Normal)
UISearchBar.appearance().setBackgroundImage(UIImage(named: "search_bar_background"), forBarPosition: .Top, barMetrics: .Default)
UISearchBar.appearance().setImage(UIImage(named: "search_icon"), forSearchBarIcon: .Search, state: .Normal)

结果我看到 UISearchBar 有 UISegmentedControl 背景

在其他屏幕上一切正常

【问题讨论】:

    标签: ios ios9 uisearchbar uisegmentedcontrol


    【解决方案1】:

    我已经找到了该问题的解决方案。问题是 UISearchBar 有“范围标题”

    我删除了这两个标题,它开始正常工作

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-19
      • 1970-01-01
      • 1970-01-01
      • 2016-05-15
      相关资源
      最近更新 更多