UIButton - can't set title colour independently of button color

In the latest version of Cocos2d-x (3.2alpha0), for a UIButton it seems you can’t set the title colour independently of the button colour.

If you use setColor with UIButton, it will also affect the title colour, due to the cascading colour behaviour.

If you disable the cascading colour behaviour on the button, then you can’t change the colour of the button at all, as the button sprites and title are all children of the button. Therefore, no colour gets through.

This seems to be a design issue more than anything. Maybe a setBackgroundColor function is needed?

Here is a setBackgroundColor function to add to UIButton.cpp:

void Button::setBackgroundColor(const Color3B& color)
{

  _buttonNormalRenderer->updateDisplayedColor(color);
  _buttonClickedRenderer->updateDisplayedColor(color);
  _buttonDisableRenderer->updateDisplayedColor(color);

}

Use this after setting the button textures. Also, you must use setCascadeColorEnabled( false ) on the UIButton after creating it.