本文整理汇总了C++中CAViewController类的典型用法代码示例。如果您正苦于以下问题:C++ CAViewController类的具体用法?C++ CAViewController怎么用?C++ CAViewController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAViewController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CC_BREAK_IF
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: switch
void CANavigationController::update(float dt)
{
CCRect rect = m_pContainer->getFrame();
switch (m_eNavigationBarVerticalAlignment)
{
case CABarVerticalAlignmentTop:
{
rect.origin.y = m_pNavigationBar->getFrame().origin.y + m_pNavigationBar->getFrame().size.height;
rect.size.height = this->getView()->getBounds().size.height - rect.origin.y;
}
break;
case CABarVerticalAlignmentBottom:
{
rect.size.height = m_pNavigationBar->getFrame().origin.y;
}
break;
default:
break;
}
m_pContainer->setFrame(rect);
for (unsigned int i=0; i<m_pViewControllers.size(); i++)
{
CAViewController* viewController = m_pViewControllers.at(i);
rect.origin.x = viewController->getView()->getFrameOrigin().x;
rect.origin.y = 0;
viewController->getSuperViewRect(rect);
}
}
示例3: pushViewControllerFinish
void CANavigationController::pushViewControllerFinish()
{
m_pContainer->setFrame(CCRect(0, m_pContainer->getFrame().origin.y, 0, 0));
CAViewController* lastViewController = m_pViewControllers.at(m_pViewControllers.size() - 2);
lastViewController->getView()->removeFromSuperview();
}
示例4: switch
void CANavigationController::update(float dt)
{
CCRect rect = this->getView()->getBounds();
CCPoint point = this->getNavigationBarNowPoint();
switch (m_eNavigationBarVerticalAlignment)
{
case CABarVerticalAlignmentTop:
{
rect.origin.y = point.y + m_tNavigationBarSize.height;
rect.size.height = rect.size.height - rect.origin.y;
}
break;
case CABarVerticalAlignmentBottom:
{
rect.size.height = point.y;
}
break;
default:
break;
}
m_pNavigationBars.back()->setFrameOrigin(point);
CAView* secondContainer = m_pSecondContainers.back();
CAViewController* viewController = m_pViewControllers.back();
secondContainer->setFrame(rect);
viewController->getSuperViewRect(secondContainer->getBounds());
}
示例5: popViewControllerAtIndex
CAViewController* CANavigationController::popViewControllerAtIndex(int index)
{
if (index >= m_pViewControllers.size() || index < 0)
{
return NULL;
}
if (index == m_pViewControllers.size() - 1)
{
return this->popViewControllerAnimated(false);
}
CAViewController* viewController = m_pViewControllers.at(index);
viewController->viewDidDisappear();
viewController->m_pNavigationController = NULL;
viewController->removeViewFromSuperview();
viewController->retain()->autorelease();
m_pViewControllers.erase(index);
m_pContainers.at(index)->removeFromSuperview();
m_pContainers.erase(index);
m_pSecondContainers.erase(index);
m_pNavigationBars.erase(index);
return viewController;
}
示例6: layoutNewContainer
void CANavigationController::layoutNewContainer()
{
CCRect navigation_bar_rect = CCRectZero;
navigation_bar_rect.size = m_tNavigationBarSize;
CCRect container_rect = this->getView()->getBounds();
if (m_bNavigationBarHidden)
{
navigation_bar_rect.origin = this->getNavigationBarTakeBackPoint();
}
else
{
container_rect.size.height -= m_tNavigationBarSize.height;
navigation_bar_rect.origin = this->getNavigationBarOpenPoint();
if (m_eNavigationBarVerticalAlignment == CABarVerticalAlignmentTop)
{
container_rect.origin.y = m_tNavigationBarSize.height;
}
}
CAView* container = m_pContainers.back();
container->setFrame(this->getView()->getBounds());
CANavigationBar* navigationBar = m_pNavigationBars.back();
navigationBar->setFrame(navigation_bar_rect);
CAView* secondContainer = m_pSecondContainers.back();
secondContainer->setFrame(container_rect);
CAViewController* viewController = m_pViewControllers.back();
viewController->addViewFromSuperview(secondContainer);
viewController->viewDidAppear();
}
示例7: switch
void CANavigationController::update(float dt)
{
CCRect rect = m_pContainer->getFrame();
switch (m_eNavigationBarVerticalAlignment)
{
case CABarVerticalAlignmentTop:
{
rect.origin.y = m_pNavigationBar->getFrame().origin.y + m_pNavigationBar->getFrame().size.height;
rect.size.height = this->getView()->getBounds().size.height - rect.origin.y;
}
break;
case CABarVerticalAlignmentBottom:
{
rect.size.height = m_pNavigationBar->getFrame().origin.y;
}
break;
default:
break;
}
m_pContainer->setFrame(rect);
CAViewController* viewController = m_pViewControllers.back();
rect.origin = CCPointZero;
viewController->getSuperViewRect(rect);
}
示例8: switch
void CATabBarController::update(float dt)
{
DRect rect = this->getView()->getFrame();
DPoint point = this->getTabBarNowPoint();
switch (m_eTabBarVerticalAlignment)
{
case CABarVerticalAlignmentTop:
{
rect.origin.y = point.y + m_pTabBar->getFrame().size.height;
rect.size.height = rect.size.height - rect.origin.y;
}
break;
case CABarVerticalAlignmentBottom:
{
rect.size.height = point.y;
}
break;
default:
break;
}
m_pTabBar->setFrameOrigin(point);
m_pContainer->setFrame(rect);
for (size_t i=0; i<m_pViewControllers.size(); i++)
{
DRect r = m_pContainer->getSubViewAtIndex((int)i)->getFrame();
r.size = rect.size;
m_pContainer->getSubViewAtIndex((int)i)->setFrame(r);
CAViewController* viewController = m_pViewControllers.at(i);
viewController->getSuperViewRect(m_pContainer->getBounds());
}
}
示例9: popToRootViewControllerAnimated
// [email protected]: 2015-03-08
void CANavigationController::popToRootViewControllerAnimated(bool animated)
{
if (m_pViewControllers.size() == 1)
{
return ;
}
float x = this->getView()->getBounds().size.width;
CAView* backContainer = m_pContainers.back();
backContainer->setFrameOrigin(DPointZero);
size_t index = 0;
CAViewController* showViewController = m_pViewControllers.at(index);
showViewController->viewDidAppear();
CAView* showContainer = m_pContainers.at(index);
showContainer->setVisible(true);
showContainer->setFrameOrigin(DPoint(-x/2.0f, 0));
{
DPoint point = this->getNavigationBarNowPoint(showViewController);
DRect rect = this->getView()->getBounds();
rect.origin.y = point.y + m_tNavigationBarSize.height;
rect.size.height = rect.size.height - rect.origin.y;
m_pNavigationBars.at(index)->setFrameOrigin(point);
CAView* secondContainer = m_pSecondContainers.at(index);
secondContainer->setFrame(rect);
showViewController->getSuperViewRect(secondContainer->getBounds());
}
CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsFalse();
if (animated)
{
CAViewAnimation::beginAnimations("", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.02f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
showContainer->setFrameOrigin(DPointZero);
CAViewAnimation::commitAnimations();
CAViewAnimation::beginAnimations("", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.03f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
CAViewAnimation::setAnimationDidStopSelector(this, CAViewAnimation0_selector(CANavigationController::popToRootViewControllerFinish));
backContainer->setFrameOrigin(DPoint(x, 0));
CAViewAnimation::commitAnimations();
}
else
{
this->popToRootViewControllerFinish();
}
}
示例10: replaceViewController
void CANavigationController::replaceViewController(CrossApp::CAViewController *viewController, bool animated)
{
if (this->getView()->getSuperview() == NULL)
{
return;
}
if (m_pContainer->getActionByTag(0))
{
return;
}
float x = m_pContainer->getFrame().size.width;
CAViewController* lastViewController = m_pViewControllers.back();
viewController->m_pNavigationController = this;
m_pViewControllers.insert(m_pViewControllers.size()-1, viewController);
viewController->addViewFromSuperview(m_pContainer);
viewController->viewDidDisappear();
viewController->getView()->setFrameOrigin(CCPoint(x, 0));
if (animated)
{
CCSequence* actionsLast =
CCSequence::create(
CCDelayTime::create(0.03f),
CCEaseSineOut::create(CCFrameOrginTo::create(0.25f, CCPoint(-x/2.0f, 0))),
NULL);
lastViewController->getView()->runAction(actionsLast);
CCSequence* actions =
CCSequence::create(
CCCallFunc::create(CAApplication::getApplication()->getTouchDispatcher(), callfunc_selector(CATouchDispatcher::setDispatchEventsFalse)),
CCDelayTime::create(0.02f),
CCEaseSineOut::create(CCFrameOrginTo::create(0.25f, CCPointZero)),
CCCallFunc::create(this, callfunc_selector(CANavigationController::replaceViewControllerFinish)),
CCCallFunc::create(CAApplication::getApplication()->getTouchDispatcher(),callfunc_selector(CATouchDispatcher::setDispatchEventsTrue)),
NULL);
viewController->getView()->runAction(actions);
}
else
{
this->replaceViewControllerFinish();
}
}
示例11: homingViewControllerFinish
void CANavigationController::homingViewControllerFinish()
{
size_t index = m_pViewControllers.size() - 2;
CAViewController* lastViewController = m_pViewControllers.at(index);
lastViewController->viewDidDisappear();
CAView* lastContainer = m_pContainers.at(index);
lastContainer->setVisible(false);
CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsTrue();
}
示例12: popViewControllerFinish
void CANavigationController::popViewControllerFinish()
{
CAViewController* lastViewController = m_pViewControllers.back();
lastViewController->m_pNavigationController = NULL;
lastViewController->removeViewFromSuperview();
lastViewController->autorelease();
m_pViewControllers.pop_back();
m_pNavigationBar->popItem();
m_pContainer->setFrame(CCRect(0, m_pContainer->getFrame().origin.y, 0, 0));
}
示例13: CC_RETURN_IF
void CANavigationController::ccTouchEnded(CATouch *pTouch, CAEvent *pEvent)
{
CC_RETURN_IF(CAViewAnimation::areBeginAnimationsWithID("navigation_animation"));
CC_RETURN_IF(m_pViewControllers.size() <= 1);
float x = this->getView()->getBounds().size.width;
size_t index = m_pViewControllers.size() - 2;
CAViewController* lastViewController = m_pViewControllers.at(index);
CAView* lastContainer = m_pContainers.at(index);
lastContainer->setVisible(true);
lastContainer->setTouchEnabled(true);
CAView* backContainer = m_pContainers.back();
backContainer->setTouchEnabled(true);
CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsFalse();
if (m_bPopViewController)
{
lastViewController->viewDidAppear();
CAViewAnimation::beginAnimations("navigation_animation", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.02f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
lastContainer->setFrameOrigin(DPointZero);
CAViewAnimation::commitAnimations();
CAViewAnimation::beginAnimations("navigation_animation2", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.03f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
CAViewAnimation::setAnimationDidStopSelector(this, CAViewAnimation0_selector(CANavigationController::popViewControllerFinish));
backContainer->setFrameOrigin(DPoint(x, 0));
CAViewAnimation::commitAnimations();
}
else
{
CAViewAnimation::beginAnimations("navigation_animation", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.03f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
lastContainer->setFrameOrigin(DPoint(-x/2.0f, 0));
CAViewAnimation::commitAnimations();
CAViewAnimation::beginAnimations("navigation_animation2", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.02f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
CAViewAnimation::setAnimationDidStopSelector(this, CAViewAnimation0_selector(CANavigationController::homingViewControllerFinish));
backContainer->setFrameOrigin(DPointZero);
CAViewAnimation::commitAnimations();
}
}
示例14: viewDidLoad
void CANavigationController::viewDidLoad()
{
CAViewController* viewController = m_pViewControllers.front();
viewController->retain()->autorelease();
m_pViewControllers.popFront();
this->createWithContainer(viewController);
m_tNavigationBarSize = m_pNavigationBars.front()->getFrame().size;
this->layoutNewContainer();
}
示例15: pushViewControllerFinish
void CANavigationController::pushViewControllerFinish()
{
CAView* lastContainer = m_pContainers.at(m_pContainers.size() - 2);
lastContainer->setVisible(false);
CAView* newContainer = m_pContainers.back();
newContainer->setFrameOrigin(DPointZero);
CAViewController* lastViewController = m_pViewControllers.at(m_pViewControllers.size() - 2);
lastViewController->viewDidDisappear();
CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsTrue();
}