UIButton setTitleColor method Bug

UIButton setTitleColor method Bug
0.0 0


I create a Widget include a UIButton using UI editor, the button text’s color is changed to other but not white. When I import
the Widget to my ios program and run on my iphone-4s, the button text’s color is white.

so I changed the origin code in UIButton.cpp:
void Button::setTitleColor(const Color3B& color) { _titleColor = color; _titleRenderer->updateDisplayedColor(color); }
void Button::setTitleColor(const Color3B& color) { _titleColor = color; _titleRenderer->setColor(color); }
then the button text’s color is my color!

I debug several hours and find nothing, I am really confused. anyone has met the same problem?

Question about cascade opacity (and color) on Widget

I did’t meet this problem.
Could tell me your CocoStudio version and your Cocos2d-x version to let me have a test?


@zijian.rao hi,
cocostudio version and cocos2dx version 3.0beta2, thank you.


This is related to this issue:

The reason setTitleColor doesn’t appear to work is because of the cascading colour behaviour, which means the colour of the button sets the colour of the title text as well.

If you disable the cascading colour behaviour on the button, then you can set the title colour normally. However, you then can’t change the button colour.

To be able to change the button colour, use the setBackgroundColor function which I included in the above topic.


Dind’t have any problems on version 3.3 rc2. But now I’m using version 3.4 for another game with exactly the same menu configuration and I’m having this issue also.