Beispiel #1
0
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;
}
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();
}
Beispiel #3
0
void CANavigationController::popViewControllerFinish()
{
    CAViewController* lastViewController = m_pViewControllers.back();
    lastViewController->viewDidDisappear();
    lastViewController->m_pNavigationController = NULL;
    lastViewController->removeViewFromSuperview();
    lastViewController->retain()->autorelease();
    m_pViewControllers.popBack();
    m_pNavigationBar->popItem();
    CAViewController* showViewController = m_pViewControllers.back();
    showViewController->getView()->setFrameOrigin(CCPointZero);
}
Beispiel #4
0
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();
}
Beispiel #5
0
void CANavigationController::pushViewControllerFinish()
{
    CAViewController* viewController = m_pViewControllers.back();
    
    if (viewController->getNavigationBarItem() == NULL && viewController->getTitle().compare("") != 0)
    {
        viewController->setNavigationBarItem(CANavigationBarItem::create(viewController->getTitle()));
    }
    m_pNavigationBar->pushItem(viewController->getNavigationBarItem());
    viewController->getView()->setFrameOrigin(CCPointZero);
    
    CAViewController* lastViewController = m_pViewControllers.at(m_pViewControllers.size() - 2);
    lastViewController->getView()->setFrameOrigin(CCPointZero);
    lastViewController->getView()->setVisible(false);
    lastViewController->viewDidDisappear();
}
void CANavigationController::pushViewControllerFinish()
{
    float x = this->getView()->getBounds().size.width;
    
    CAView* lastContainer = m_pContainers.at(m_pContainers.size() - 2);
    lastContainer->setVisible(false);
    lastContainer->setFrameOrigin(CCPoint(-x/2.0f, 0));
    
    CAView* newContainer = m_pContainers.back();
    newContainer->setFrameOrigin(CCPointZero);
    
    CAViewController* lastViewController = m_pViewControllers.at(m_pViewControllers.size() - 2);
    lastViewController->viewDidDisappear();
    
    m_bSlidingMinX = m_pViewControllers.size() <= 1;
    CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsTrue();
}
Beispiel #7
0
void CANavigationController::replaceViewControllerFinish()
{
    CAViewController* lastViewController = m_pViewControllers.back();
    lastViewController->retain()->autorelease();
    m_pViewControllers.popBack();
    m_pNavigationBar->popItem();
    lastViewController->viewDidDisappear();
    lastViewController->removeViewFromSuperview();
    
    CAViewController* viewController = m_pViewControllers.back();
    viewController->getView()->setFrameOrigin(CCPointZero);
    if (viewController->getNavigationBarItem() == NULL && viewController->getTitle().compare("") != 0)
    {
        viewController->setNavigationBarItem(CANavigationBarItem::create(viewController->getTitle()));
    }
    m_pNavigationBar->pushItem(viewController->getNavigationBarItem());
}
Beispiel #8
0
void CANavigationController::replaceViewControllerFinish()
{
    CAView* newContainer = m_pContainers.back();
    newContainer->setFrameOrigin(DPointZero);
    
    size_t index = m_pViewControllers.size() - 2;
    CAViewController* lastViewController = m_pViewControllers.at(index);
    lastViewController->viewDidDisappear();
    lastViewController->m_pNavigationController = NULL;
    lastViewController->removeViewFromSuperview();
    m_pViewControllers.erase(index);
    
    CAView* backContainer = m_pContainers.at(index);
    backContainer->removeFromSuperview();
    m_pContainers.erase(index);
    m_pSecondContainers.erase(index);
    m_pNavigationBars.erase(index);
    CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsTrue();
}
Beispiel #9
0
void CANavigationController::popViewControllerFinish()
{
    CAViewController* backViewController = m_pViewControllers.back();
    backViewController->viewDidDisappear();
    backViewController->m_pNavigationController = NULL;
    backViewController->removeViewFromSuperview();
    backViewController->retain()->autorelease();
    m_pViewControllers.popBack();
    
    m_pContainers.back()->removeFromSuperview();
    m_pContainers.popBack();
    
    m_pSecondContainers.popBack();
    
    m_pNavigationBars.popBack();
    
    m_pContainers.back()->setFrameOrigin(DPointZero);
    
    CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsTrue();
}
Beispiel #10
0
CAViewController* CANavigationController::popFirstViewController()
{
    if (m_pViewControllers.size() <= 1)
    {
        return NULL;
    }
    
    CAViewController* frontViewController = m_pViewControllers.front();
    frontViewController->viewDidDisappear();
    frontViewController->m_pNavigationController = NULL;
    frontViewController->removeViewFromSuperview();
    frontViewController->retain()->autorelease();
    m_pViewControllers.popFront();
    
    m_pContainers.front()->removeFromSuperview();
    m_pContainers.popFront();
    
    m_pSecondContainers.popFront();
    
    m_pNavigationBars.popFront();
    
    return frontViewController;
}
Beispiel #11
0
// [email protected]: 2015-03-08
void CANavigationController::popToRootViewControllerFinish()
{
    while (m_pViewControllers.size() > 1)
    {
        CAViewController* backViewController = m_pViewControllers.back();
        backViewController->viewDidDisappear();
        backViewController->m_pNavigationController = NULL;
        backViewController->removeViewFromSuperview();
        m_pViewControllers.popBack();
        
        m_pContainers.back()->removeFromSuperview();
        m_pContainers.popBack();
        
        m_pSecondContainers.popBack();
        
        m_pNavigationBars.popBack();
    }
    
    m_pViewControllers.back()->getView()->setFrameOrigin(CCPointZero);
    
    m_bSlidingMinX = true;
    CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsTrue();
}