sprhawk@163.com: 2015-03-08
| 738 | |
| 739 | // sprhawk@163.com: 2015-03-08 |
| 740 | void CANavigationController::popToRootViewControllerAnimated(bool animated) |
| 741 | { |
| 742 | if (m_pViewControllers.size() == 1) |
| 743 | { |
| 744 | return ; |
| 745 | } |
| 746 | |
| 747 | float x = this->getView()->getBounds().size.width; |
| 748 | |
| 749 | CAView* backContainer = m_pContainers.back(); |
| 750 | backContainer->setFrameOrigin(DPointZero); |
| 751 | |
| 752 | size_t index = 0; |
| 753 | CAViewController* showViewController = m_pViewControllers.at(index); |
| 754 | showViewController->viewDidAppear(); |
| 755 | |
| 756 | CAView* showContainer = m_pContainers.at(index); |
| 757 | showContainer->setVisible(true); |
| 758 | showContainer->setFrameOrigin(DPoint(-x/3.0f, 0)); |
| 759 | |
| 760 | { |
| 761 | int y = this->getNavigationBarNowY(showViewController); |
| 762 | |
| 763 | CANavigationBar* navBar = m_pNavigationBars.at(index); |
| 764 | DLayout navLayout = navBar->getLayout(); |
| 765 | navLayout.vertical.top = y; |
| 766 | navBar->setLayout(navLayout); |
| 767 | |
| 768 | CAView* secondContainer = m_pSecondContainers.at(index); |
| 769 | DLayout secondLayout = secondContainer->getLayout(); |
| 770 | secondLayout.vertical.top = navLayout.vertical.top + navLayout.vertical.height; |
| 771 | secondContainer->setLayout(secondLayout); |
| 772 | } |
| 773 | |
| 774 | CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsFalse(); |
| 775 | |
| 776 | if (animated) |
| 777 | { |
| 778 | CAViewAnimation::beginAnimations("", NULL); |
| 779 | CAViewAnimation::setAnimationDuration(0.25f); |
| 780 | CAViewAnimation::setAnimationDelay(0.02f); |
| 781 | CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut); |
| 782 | showContainer->setFrameOrigin(DPointZero); |
| 783 | CAViewAnimation::commitAnimations(); |
| 784 | |
| 785 | CAViewAnimation::beginAnimations("", NULL); |
| 786 | CAViewAnimation::setAnimationDuration(0.25f); |
| 787 | CAViewAnimation::setAnimationDelay(0.03f); |
| 788 | CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut); |
| 789 | CAViewAnimation::setAnimationDidStopSelector(this, CAViewAnimation0_selector(CANavigationController::popToRootViewControllerFinish)); |
| 790 | backContainer->setFrameOrigin(DPoint(x, 0)); |
| 791 | CAViewAnimation::commitAnimations(); |
| 792 | } |
| 793 | else |
| 794 | { |
| 795 | this->popToRootViewControllerFinish(); |
| 796 | } |
| 797 | } |
nothing calls this directly
no test coverage detected