iphoneiosuisearchbaruitoolbaruitoolbaritem

UIToolbar shows different color on ios 5.0 and ios 6.0 Simulators


I have set tintcolor for my UIToolBar.It displays Correctly in ios 6.0 but it shows black color on ios 5.0 simulator. My code is here

originalBounds = mysearchBarBarItem.customView.bounds;
mySearchBar.bounds = CGRectMake(0,0,215,44);
myTopToolbar.tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:NAVIGATION_BAR_BACKGROUND]];
myTopToolbar.barStyle = UIBarStyleDefault;

mySearchBar.barStyle = UIBarStyleDefault;
mySearchBar.tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:NAVIGATION_BAR_BACKGROUND]];

[myTopToolbar setItems:toolBarItemsArray animated:YES];

Solution

  • I don't know if this can make a difference, but you could try to change the order in which you assign the style and color of the bar. Try:

    myTopToolbar.barStyle = UIBarStyleDefault;   
    myTopToolbar.tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:NAVIGATION_BAR_BACKGROUND]];
    

    It's possible that assigning the style after changing the tintcolor resets the color.

    EDIT

    Why this would affect only ios5 and not ios6 I don't know.