本文整理汇总了C++中CAViewController::getTabBarItem方法的典型用法代码示例。如果您正苦于以下问题:C++ CAViewController::getTabBarItem方法的具体用法?C++ CAViewController::getTabBarItem怎么用?C++ CAViewController::getTabBarItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAViewController
的用法示例。
在下文中一共展示了CAViewController::getTabBarItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initWithViewControllers
bool CATabBarController::initWithViewControllers(const std::vector<CAViewController*>& viewControllers)
{
CAViewController::init();
do
{
CC_BREAK_IF(viewControllers.size() == 0);
m_pViewControllers.insert(m_pViewControllers.begin(), viewControllers.begin(), viewControllers.end());
std::vector<CATabBarItem*> items;
for (unsigned int i=0; i<m_pViewControllers.size(); i++)
{
CAViewController* view = m_pViewControllers.at(i);
view->retain();
view->m_pTabBarController = this;
if (view->getTabBarItem() == NULL)
{
const char* title = CCString::createWithFormat("item%d",i)->getCString();
CATabBarItem* item = CATabBarItem::create(title, NULL, i);
view->setTabBarItem(item);
}
items.push_back(view->getTabBarItem());
}
m_pTabBar = CATabBar::create(items);
m_pTabBar->retain();
m_pTabBar->setDelegate(this);
}
while (0);
return true;
}
示例2: initWithViewControllers
bool CATabBarController::initWithViewControllers(const std::vector<CAViewController*>& viewControllers, CABarVerticalAlignment var)
{
CAViewController::init();
do
{
CC_BREAK_IF(viewControllers.size() == 0);
m_pViewControllers.insert(m_pViewControllers.begin(), viewControllers.begin(), viewControllers.end());
std::vector<CATabBarItem*> items;
for (unsigned int i=0; i<m_pViewControllers.size(); i++)
{
CAViewController* view = m_pViewControllers.at(i);
view->retain();
view->m_pTabBarController = this;
if (view->getTabBarItem() == NULL)
{
const char* title = CCString::createWithFormat("item%d",i)->getCString();
CATabBarItem* item = CATabBarItem::create(title, NULL);
item->setTag(i);
view->setTabBarItem(item);
}
items.push_back(view->getTabBarItem());
}
m_pTabBar = CATabBar::create(items);
m_pTabBar->retain();
m_pTabBar->setAnchorPoint(CCPointZero);
m_pTabBar->setDelegate(this);
m_pContainer = new CAScrollView();
m_pContainer->initWithFrame(CCRectZero);
m_pContainer->setScrollEnabled(false);
m_pContainer->setBounces(false);
m_pContainer->setShowsHorizontalScrollIndicator(false);
m_pContainer->setShowsVerticalScrollIndicator(false);
}
while (0);
m_eTabBarVerticalAlignment = var;
return true;
}
示例3: initWithViewControllers
bool CATabBarController::initWithViewControllers(const CAVector<CAViewController*>& viewControllers, CABarVerticalAlignment var)
{
CAViewController::init();
do
{
CC_BREAK_IF(viewControllers.size() == 0);
m_pViewControllers = viewControllers;
std::vector<CATabBarItem*> items;
for (unsigned int i=0; i<m_pViewControllers.size(); i++)
{
CAViewController* view = m_pViewControllers.at(i);
if (view->getTabBarItem() == NULL)
{
char title[8];
sprintf(title, "item%d", i);
CATabBarItem* item = CATabBarItem::create(title, NULL);
item->setTag(i);
view->setTabBarItem(item);
}
items.push_back(view->getTabBarItem());
view->m_pTabBarController = this;
}
m_pTabBar = CATabBar::create(items);
m_pTabBar->retain();
m_pTabBar->setDelegate(this);
}
while (0);
m_eTabBarVerticalAlignment = var;
return true;
}
示例4: viewDidLoad
void CATabBarController::viewDidLoad()
{
std::vector<CATabBarItem*> items;
for (unsigned int i=0; i<m_pViewControllers.size(); i++)
{
CAViewController* view = m_pViewControllers.at(i);
if (view->getTabBarItem() == NULL)
{
char title[8];
sprintf(title, "item%d", i);
CATabBarItem* item = CATabBarItem::create(title, NULL);
item->setTag(i);
view->setTabBarItem(item);
}
items.push_back(view->getTabBarItem());
view->m_pTabBarController = this;
}
m_pTabBar = CATabBar::create(items, DSize(this->getView()->getBounds().size.width, 0), m_eTabBarVerticalAlignment);
this->getView()->addSubview(m_pTabBar);
m_pTabBar->setDelegate(this);
DRect container_rect = this->getView()->getBounds();
DPoint tab_bar_rectOrgin = DPointZero;
if (m_bTabBarHidden)
{
tab_bar_rectOrgin = this->getTabBarTakeBackPoint();
}
else
{
tab_bar_rectOrgin = this->getTabBarOpenPoint();
container_rect.size.height -= m_pTabBar->getFrame().size.height;
if (m_eTabBarVerticalAlignment == CABarVerticalAlignmentTop)
{
container_rect.origin.y = m_pTabBar->getFrame().size.height;
}
}
DSize container_view_size = container_rect.size;
container_view_size.width *= m_pViewControllers.size();
m_pContainer = CAPageView::createWithFrame(container_rect, CAPageViewDirectionHorizontal);
m_pContainer->setBackgroundColor(CAColor_clear);
m_pContainer->setPageViewDelegate(this);
m_pContainer->setScrollViewDelegate(this);
m_pContainer->setScrollEnabled(m_bScrollEnabled);
m_pContainer->setDisplayRange(true);
this->getView()->addSubview(m_pContainer);
CAVector<CAView*> views;
for (int i=0; i<m_pViewControllers.size(); i++)
{
CAView* view = new CAView();
views.pushBack(view);
view->release();
}
m_pContainer->setViews(views);
if (m_pTabBarBackgroundImage)
{
m_pTabBar->setBackgroundImage(m_pTabBarBackgroundImage);
}
else
{
m_pTabBar->setBackgroundColor(m_sTabBarBackgroundColor);
}
if (m_pTabBarSelectedBackgroundImage)
{
m_pTabBar->setSelectedBackgroundImage(m_pTabBarSelectedBackgroundImage);
}
else
{
m_pTabBar->setSelectedBackgroundColor(m_sTabBarSelectedBackgroundColor);
}
if (m_pTabBarSelectedIndicatorImage)
{
m_pTabBar->setSelectedIndicatorImage(m_pTabBarSelectedIndicatorImage);
}
else
{
m_pTabBar->setSelectedIndicatorColor(m_sTabBarSelectedIndicatorColor);
}
m_pTabBar->setTitleColorForNormal(m_sTabBarTitleColor);
m_pTabBar->setTitleColorForSelected(m_sTabBarSelectedTitleColor);
if (m_bShowTabBarSelectedIndicator)
{
m_pTabBar->showSelectedIndicator();
}
m_pTabBar->setFrameOrigin(tab_bar_rectOrgin);
//.........这里部分代码省略.........