Forum > Extensions > share a simple CCTabView UI control

share a simple CCTabView UI control

By yxmaomao Posted 2012-03-12 11:48 Comments 15
yxmaomao
  • Posts: 11

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)

yxmaomao
  • Posts: 11

#1 RE: 2012-03-12 11:48

cpp file

CCTabView.cpp (8.3 kB)

yxmaomao
  • Posts: 11

#2 RE: 2012-03-12 11:52

how to use it?
please follow the below:

CCTabView * myTab = new CCTabView(CCRectMake(50, 20, 380, 300));
myTab~~>autorelease;
CCLayerColor * mylay = CCLayerColor::layerWithColorWidthHeight,200,100);
CCLabelTTF * lbl = CCLabelTTF::labelWithString;
lbl~~>setPosition(ccp(50,50));
mylay~~>addChild;
CCLayerColor * mylay1 = CCLayerColor::layerWithColorWidthHeight,200,100);
CCLabelTTF * lbl1 = CCLabelTTF::labelWithString;
lbl1~~>setPosition(ccp(50,50));
mylay1~~>addChild;
CCLayerColor * mylay2 = CCLayerColor::layerWithColorWidthHeight,200,100);
CCLabelTTF * lbl2 = CCLabelTTF::labelWithString;
lbl2~~>setPosition(ccp(50,50));
mylay2~~>addChild;
myTab~~>addTab(“tab1”, mylay);
myTab~~>addTab;
myTab~~>addTab(“tab3”, mylay2);
this->addChild(myTab);

yuejie
  • Posts: 4

#3 RE: 2012-03-12 11:59

Thx 4 ur sharing

emmyc
  • Posts: 73
  • Location: US

#4 RE: 2012-03-13 01:51

Thanks for sharing[]()

enjoy work!

kbwave
  • Posts: 21
  • Location: S.korea

#5 RE: 2012-03-13 02:16

thx so it’s requires 4 png images?

walzer
  • Posts: 1735
  • Location: Xiamen, China

#6 RE: 2012-03-16 14:10

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

Less is More. Keep Focus.

yxmaomao
  • Posts: 11

#7 RE: 2012-03-23 06:14

screenshot uploaded

yxmaomao
  • Posts: 11

#8 RE: 2012-03-23 06:15

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

yxmaomao
  • Posts: 11

#9 RE: 2012-03-23 06:17

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

jandujar
  • Posts: 175
  • Location: Spain

#10 RE: 2012-05-10 10:39

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 10m downloads of my first game "Guess the Character"

zmzsoftware@gmail.com
  • Posts: 17

#11 RE: 2012-08-22 04:58

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

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

what is wrong[]()[]()

zhangl_1989@163.com
  • Posts: 2

#12 RE: 2012-10-29 04:05

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

zhangl_1989@163.com
  • Posts: 2

#13 RE: 2012-10-29 04:05

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

virajdasondi@gmail.com
  • Posts: 113
  • Location: India

#14 RE: 2013-04-10 09:56

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

CCTabView * myTab = new CCTabView(CCRectMake(50, 20, 380, 300));
myTab~~>autorelease;
CCLayerColor * mylay = CCLayerColor::create,200,100);
CCLabelTTF * lbl = CCLabelTTF::create;
lbl~~>setPosition(ccp(50,50));
mylay~~>addChild;
CCLayerColor * mylay1 = CCLayerColor::create,200,100);
CCLabelTTF * lbl1 = CCLabelTTF::create;
lbl1~~>setPosition(ccp(50,50));
mylay1~~>addChild;
CCLayerColor * mylay2 = CCLayerColor::create,200,100);
CCLabelTTF * lbl2 = CCLabelTTF::create;
lbl2~~>setPosition(ccp(50,50));
mylay2~~>addChild;
myTab~~>addTab(“tab1”, mylay);
myTab~~>addTab;
myTab~~>addTab(“tab3”, mylay2);
this->addChild(myTab);

virajdasondi@gmail.com
  • Posts: 113
  • Location: India

#15 RE: 2013-04-10 09:59

Ok solved..

I am using cocos2dx 2.0.4 and using CCArray in CCTabView.
I forgot to retain tabNameArray andtabViewArray

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps