scrollview 添加子元素为什么每次都默认到最后边。。本来有8个我删掉3个。但是添加的时候还是添加到index=7的位置了
//删除的代码
UIScrollView* ranking_scrollview = static_cast<UIScrollView*>(m_pUILayer->getWidgetByName(“ranking_ScrollView”));
Layout* shop_layout = static_cast<Layout*>(ranking_scrollview->getChildren()->objectAtIndex(0));
int index = ranking_scrollview->getChildren()->count()-1;
ranking_scrollview->getChildren()->removeObjectAtIndex(index);
//添加的代码
唀IScrollView* ranking_scrollview = static_cast<UIScrollView*>(m_pUILayer->getWidgetByName(“ranking_ScrollView”));
UIPanel* panel=UIPanel::create();
panel->setTouchEnable(true);
panel->setSize(CCSizeMake(118,44));
panel->setBackGroundImage(“cocosgui/gui_examples/DemoShop/slot.png”);
UILabel* label1=UILabel::create();
label1->setText(“sdfsdfsdf”);
label1->setPosition(ccp(50,20));
panel->addChild(label1);
UILabel* label2=UILabel::create();
label2->setText(“sdfsdfsdf”);
label2->setColor(ccc3(255,0,0));
label2->setPosition(ccp(150,20));
panel->addChild(label2);
ranking_scrollview->addChild(panel);