UISearchBar自定义后台问题
UISearchBar custom background issue
我在为 UISearchBar 设置自定义背景时遇到问题。 UISearchBar 添加为 UITableView 的 header。对于设置背景,我使用下一行:
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
在其他屏幕上一切正常
我在为 UISearchBar 设置自定义背景时遇到问题。 UISearchBar 添加为 UITableView 的 header。对于设置背景,我使用下一行:
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
在其他屏幕上一切正常