Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-953] allow buttons in toolbars to support any valid color value (instead of just white)

GitHub Issuen/a
Resolution Date2011-04-15T02:40:05.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
ReporterNolan Wright
AssigneeBlain Hamon


self explanatory




  1. Blain Hamon 2011-04-15

    Not fully explained. Do you mean the text color of buttons? The background color?

    Is this the toolbar buttons that have no boundary (IE, just the text?) or of toolbar buttons that have a border?

    Do note that standard UIBarButtonItems (IE, the type you expect to see on toolbars and navBars) do not have any mechanism for changing background color, text color, text font, or size of text.

    Any exposing of these properties will require us to recreate simulations instead of using the built-in native buttons.

  2. Thomas Huelbert 2011-04-15

    back to Nolan "needs more info"

  3. Nolan Wright 2011-04-15

    when you place a button in the toolbar (non-bar style), you should be able to set the background color

  4. Thomas Huelbert 2011-04-15

    back to Blain

  5. Blain Hamon 2011-04-15

    Okay, I've attached a screenshot from Interface Builder to better illustrate things. In the picture are two bars.

    The top bar is of bar button items. With bar button items, we can set the text, OR a premade image, OR an image, and one of three styles: Bordered, Done, and Plain. Font is unchangeable. Text color is unchangeable. Background color is unchangeable, as it's based on the owning bar's color in the case of Bordered, and is always blue in the case of Done.

    Unrelated, but while I was researching this, I noticed a new premade button, of page curl, added as of 4.0, that we might want to introduce. It ignores the style property.

    The bottom bar is of buttons added to the bar. This is a different layout, and one we use when we have backgroundImage, etc. The first button is a rounded rectangle, no background color. The second is with the background color. Note that this background color is put behind the rounded rectangle, not in it. The third is a custom button, with no rounded rectangle, but as you can see, the background color is just an ugly rectangle.

    Finally, I made a custom button with text font, text color, Shadow, shadow color, and shows-touch changed to resemble the bar button item. However, this is a simulation. Worse yet, this is probably incompatible with the bordered and done styles.

    Bouncing back to Nolan for better clarification of what's desired from what we can do.

  6. Nolan Wright 2011-04-15

    ok, i believe this is about using the BAR style button (like the top ones in your screenshot), but being able to apply any backgroundColor to the button regardless of the bar color. We may already support this - can't remember.

  7. Blain Hamon 2011-04-15

    Ah. I think this is a case of the iPhone OS API being confusing. We have several items that are closely related, so that they overlap in some areas, and sadly not in others.

    UIBarButtonItems (using the native terminology here) are actually not buttons in that they're not views, but represent the buttons you see. They have no view manifestation, and can exist nowhere but within a bar. They come with the various built-in system icons and three backgrounds: plain, bordered (which ALWAYS is the bar's color), and done (which ALWAYS is the blue). As they are not views, there are no colors to set, nor is there anything to insert backgrounds into.

    UISegmentedControl is represented in Titanium as both ButtonBar and TabbedBar. It is a view, and has a style that resembles a bordered-style UIBarButtonItem. When placed directly in a bar, it takes on the bar's tint. However, we have fixed this to be any custom color before, by placing it in a view, and then placing THAT in the bar. And a segmented control can have only one segment. So this may be when we already supported it, IE, insert a button bar with only one element, and tint that. However, as this is not a UIBarButtonItem, no system-provided icons are available, nor is the plain and done styles supported.

    ( We also had back buttons that were showing up as the color of the previous windows due to a race condition with the nav bar. This was only with back buttons, and was not easily recreatable. )

    This makes the unfavorable situation where, in order to support background colors, we lose system icons or worse yet, make an almost random set of rules about what is supported.

    Proposing that this be marked Invalid, with the workaround noted that, when someone wants to have a background color, to use a buttonbar instead.

  8. Ygor Lemos 2012-09-16

    This should be better explained on docs. many users struggle with Buttons, Button Colors and Backgrounds, specially when those buttons are part of a Nav bar, Tabbedbar or ButtonBar.
  9. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source