michael yue share a simple CCTabView UI control
Posts 6
Added by michael yue about 1 year ago

as subject means ,
just share my simple CCTabView UI control

in the fact , the control needs four images
tab_active, tab_normal, padding line, and four angles

CCTabView.h - header file (1.9 kB)

michael yue RE: share a simple CCTabView UI control
Posts 6
Added by michael yue about 1 year ago

cpp file

CCTabView.cpp (8.3 kB)

michael yue RE: share a simple CCTabView UI control
Posts 6
Added by michael yue about 1 year ago

how to use it?
please follow the below:

CCTabView * myTab = new CCTabView(CCRectMake(50, 20, 380, 300));
myTab->autorelease();

CCLayerColor * mylay = CCLayerColor::layerWithColorWidthHeight(ccc4(255, 0, 0,120),200,100);
CCLabelTTF * lbl = CCLabelTTF::labelWithString("tab1","Thonburi",18);
lbl->setPosition(ccp(50,50));
mylay->addChild(lbl);
CCLayerColor * mylay1 = CCLayerColor::layerWithColorWidthHeight(ccc4(0, 255, 0,120),200,100);
CCLabelTTF * lbl1 = CCLabelTTF::labelWithString("tab2","Thonburi",18);
lbl1->setPosition(ccp(50,50));
mylay1->addChild(lbl1);
CCLayerColor * mylay2 = CCLayerColor::layerWithColorWidthHeight(ccc4(0,50, 220,120),200,100);
CCLabelTTF * lbl2 = CCLabelTTF::labelWithString("tab3","Thonburi",18);
lbl2->setPosition(ccp(50,50));
mylay2->addChild(lbl2);
myTab->addTab("tab1", mylay);
myTab->addTab("tab2", mylay1);
myTab->addTab("tab3", mylay2);
this->addChild(myTab);
yuejie wang RE: share a simple CCTabView UI control
Posts 4
Added by yuejie wang about 1 year ago

Thx 4 ur sharing

Emmy Chen RE: share a simple CCTabView UI control
Posts 42
Added by Emmy Chen about 1 year ago

Thanks for sharing!!

K pop RE: share a simple CCTabView UI control
Posts 21
Location S.korea
Added by K pop about 1 year ago

thx so it's requires 4 png images?

Zhe Wang RE: share a simple CCTabView UI control
Posts 1642
Location Amoy, China
Added by Zhe Wang about 1 year ago

Thanks michael. Could you paste a screenshot so we can have rich info in Assets channel. http://www.cocos2d-x.org/projects/cocos2d-x/assets/2

Enjoy Coding, Enjoy Life.

michael yue RE: share a simple CCTabView UI control
Posts 6
Added by michael yue about 1 year ago

screenshot uploaded

michael yue RE: share a simple CCTabView UI control
Posts 6
Added by michael yue about 1 year ago

Hi Walzer,

I have no right to access your link : http://www.cocos2d-x.org/projects/cocos2d-x/assets/2

Could you please help me out?

thanks in advance

michael yue RE: share a simple CCTabView UI control
Posts 6
Added by michael yue about 1 year ago

RE: share a simple CCTabView UI control - Added by K pop 10 days ago
thx so it's requires 4 png images?

--------- yes, that needs 4png images

but which are my company,
I have no right to upload them.

So sorry for that

Jose Antonio Andujar RE: share a simple CCTabView UI control
Posts 82
Location Spain
Added by Jose Antonio Andujar about 1 year ago

And can you tell us the size of every image? So we can made something similar with other graphics.

#define TAB_NORMAL "tab_normal.png"
#define TAB_ACTIVE "tab_active.png"
#define TAB_LINE "tab_line.png"
#define TAB_EDGE "tab_kuan.9.png"

http://www.jandusoft.com
More than 7m downloads of my first game "Guess the Character"

zhang mouz RE: share a simple CCTabView UI control
Posts 17
Added by zhang mouz 9 months ago

Compiled error in here
CC_SYNTHESIZE(CCMutableArray<CCString *> *,_tabNameArray,TabNameArray);

错误 1 error C2143: 语法错误 : 缺少“;”(在“<”的前面) c:\users\fu\desktop\ccos2dx\else\table\cctabview.h 64

what is wrong!!!!

zhang long RE: share a simple CCTabView UI control
Posts 2
Added by zhang long 7 months ago

thanks for sharing,it's very useful for me!

zhang long RE: share a simple CCTabView UI control
Posts 2
Added by zhang long 7 months ago

thanks for sharing,it's very useful for me!:)

Viraj Dasondi RE: share a simple CCTabView UI control
Posts 113
Location India
Added by Viraj Dasondi about 1 month ago

When selecting 2nd or 3rd tab it is crashing..

CCTabView * myTab = new CCTabView(CCRectMake(50, 20, 380, 300));
myTab->autorelease();
CCLayerColor * mylay = CCLayerColor::create(ccc4(255, 0, 0,120),200,100);
CCLabelTTF * lbl = CCLabelTTF::create("tab1","Thonburi",18);
lbl->setPosition(ccp(50,50));
mylay->addChild(lbl);
CCLayerColor * mylay1 = CCLayerColor::create(ccc4(0, 255, 0,120),200,100);
CCLabelTTF * lbl1 = CCLabelTTF::create("tab2","Thonburi",18);
lbl1->setPosition(ccp(50,50));
mylay1->addChild(lbl1);
CCLayerColor * mylay2 = CCLayerColor::create(ccc4(0,50, 220,120),200,100);
CCLabelTTF * lbl2 = CCLabelTTF::create("tab3","Thonburi",18);
lbl2->setPosition(ccp(50,50));
mylay2->addChild(lbl2);
myTab->addTab("tab1", mylay);
myTab->addTab("tab2", mylay1);
myTab->addTab("tab3", mylay2);
this->addChild(myTab);
Viraj Dasondi RE: share a simple CCTabView UI control
Posts 113
Location India
Added by Viraj Dasondi about 1 month ago

Ok solved..

I am using cocos2dx 2.0.4 and using CCArray in CCTabView.
I forgot to retain _tabNameArray and _tabViewArray


(1-15/15)