Home > other >  New problems
New problems

Time:09-18

How do I remove a button?

CodePudding user response:

Cocos inside control seems unable to delete, because such as the button control is written in the resource file json, I generally is hidden, the code is as follows:
 
Self. TestBtn=cc. Uiloader: seekNodeByName (self, "testBtn")
-- - temporarily hide button
Self. TestBtn: setVisible (false)


Suggested that I try

CodePudding user response:

Delete method, BTN - & gt; RemoveFromParent (), or parent - & gt; RemoveChildByTag (BTN - & gt; GetTag ())
Upstairs is hidden, not delete,

CodePudding user response:

RemoveFromParent ()

RemoveChildByTag (BTN - & gt; GetTag ())

RemoveChildByName (BTN - & gt; GetName ())
  • Related