MCPcopy Create free account
hub / github.com/9miao/CrossApp / popViewControllerAnimated

Method popViewControllerAnimated

CrossApp/controller/CAViewController.cpp:651–716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

649}
650
651CAViewController* CANavigationController::popViewControllerAnimated(bool animated)
652{
653 if (m_pViewControllers.size() == 1)
654 {
655 return NULL;
656 }
657
658 float x = this->getView()->getBounds().size.width;
659
660 CAViewController* backViewController = m_pViewControllers.back();
661 CAView* backContainer = m_pContainers.back();
662 {
663 backContainer->setFrameOrigin(DPointZero);
664 }
665
666 size_t index = m_pViewControllers.size() - 2;
667 CAViewController* showViewController = m_pViewControllers.at(index);
668 showViewController->viewDidAppear();
669
670 CAView* showContainer = m_pContainers.at(index);
671 showContainer->setVisible(true);
672
673
674 {
675 int y = this->getNavigationBarNowY(showViewController);
676
677 CANavigationBar* navBar = m_pNavigationBars.at(index);
678 DLayout navLayout = navBar->getLayout();
679 navLayout.vertical.top = y;
680 navBar->setLayout(navLayout);
681
682 CAView* secondContainer = m_pSecondContainers.at(index);
683 DLayout secondLayout = secondContainer->getLayout();
684 secondLayout.vertical.top = navLayout.vertical.top + navLayout.vertical.height;
685 secondContainer->setLayout(secondLayout);
686 }
687
688 CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsFalse();
689
690 if (animated)
691 {
692 DRect rect = this->getView()->getBounds();
693 rect.origin = DPoint(-x/3.0f, 0);
694 showContainer->setFrame(rect);
695
696 CAViewAnimation::beginAnimations("", NULL);
697 CAViewAnimation::setAnimationDuration(0.25f);
698 CAViewAnimation::setAnimationDelay(1/30.0f);
699 CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
700 showContainer->setFrameOrigin(DPointZero);
701 CAViewAnimation::commitAnimations();
702
703 CAViewAnimation::beginAnimations("", NULL);
704 CAViewAnimation::setAnimationDuration(0.25f);
705 CAViewAnimation::setAnimationDelay(1/60.0f);
706 CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
707 CAViewAnimation::setAnimationDidStopSelector(this, CAViewAnimation0_selector(CANavigationController::popViewControllerFinish));
708 backContainer->setFrameOrigin(DPoint(x, 0));

Calls 13

getNavigationBarNowYMethod · 0.95
DPointClass · 0.85
getViewMethod · 0.80
setFrameOriginMethod · 0.80
setLayoutMethod · 0.80
getTouchDispatcherMethod · 0.80
sizeMethod · 0.45
backMethod · 0.45
viewDidAppearMethod · 0.45
setVisibleMethod · 0.45

Tested by

no test coverage detected