1. The uibutton button has three statuses: Normal, pressed, and disabled, when we set our three state images in the cocostudio Editor, when we use the setenabled (false); Method in our project, we find that uibutton disappears, the solution is as follows:
① Enter uiwidget. cpp
Find the visit (); method. here we need to modify the visit (); method to remove the if judgment.
The result is as follows:
Void Widget: visit ()
{
Ccnode: visit ();
}
② ModifyWidget::setEnable()
Method, you only need to add a line of code, as shown below
Void Widget: setenabled (bool enabled)
{
_ Enabled = enabled;
If (_ widgetchildren & _ widgetchildren-> count ()> 0)
{
Ccobject * child;
Ccarray_foreach (_ widgetchildren, child)
{
(Widget *) Child)-> setenabled (Enabled );
}
}
Setbright (Enabled); // Add this row
}
Cocos2d-x cocostudio uibutton control setenabled (false) method failure Solution