Has anyone managed to color the scopebar portion of a UISearchBar, it has a tintColor property but setting it does not affect the attached scopebar UISegmentedControl. Ive got a
This solution is in Swift, can be adapted to objective-c. You can find the segmented control view using below function
func findSegmentedControl(view : UIView) -> UIView? {
for v in view.subviews {
if v is UISegmentedControl {
print(v)
return v
} else {
if let found = findSegmentedControl(view : v) {
return found
}
}
}
return nil
}
and then set tint color of the view. calling this function will be like this:
if let segmentedView = findSegmentedControl(view: searchController.searchBar) {
segmentedView.tintColor = UIColor.white
}