Search code examples
iphoneiosios4cocos2d-iphone

UISearchBar scopebar tint color issue


While using uisearchbar with scope bar the tint color of scope bar is not updating in iOS 4.3.In remaining iOS versions it is working perfectly.I have shown the screenshot of that sample here.Any ideas to solve this please.enter image description here


Solution

  • for (id subview in yourSearchDisplayController.searchBar.subviews )
    {
        if([subview isMemberOfClass:[UISegmentedControl class]])
        {
            UISegmentedControl *scopeBar=(UISegmentedControl *) subview;
            [scopeBar setSegmentedControlStyle:UISegmentedControlStyleBar];
            [scopeBar setTintColor: [UIColor redColor]];//you can also set RGB color here 
            //scopeBar.tintColor =  [UIColor blackColor];         
        }
    }
    

    Also see my answer from this link for modify the UISearchBar component

    How to change inside background color of UISearchBar component on iOS