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

Method createWithContainer

CrossApp/controller/CAViewController.cpp:462–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460}
461
462void CANavigationController::createWithContainer(CAViewController* viewController, const DLayout& layout)
463{
464 CAView* container = new CAView();
465 container->setLayout(layout);
466 this->getView()->addSubview(container);
467 m_pContainers.pushBack(container);
468 container->release();
469
470 DLayout navLayout;
471 navLayout.horizontal = DHorizontalLayoutFill;
472 navLayout.vertical.height = m_iNavigationBarHeight;
473
474 if (m_bNavigationBarHidden
475 ||
476 (viewController->getNavigationBarItem() && viewController->getNavigationBarItem()->isNagigationBarHidden()))
477 {
478 navLayout.vertical.top = -m_iNavigationBarHeight;
479 }
480 else
481 {
482 navLayout.vertical.top = 0;
483 }
484
485 CANavigationBar* navigationBar = CANavigationBar::createWithLayout(navLayout, m_bClearance);
486 if (viewController->getNavigationBarItem() == NULL && viewController->getTitle().compare("") != 0)
487 {
488 viewController->setNavigationBarItem(CANavigationBarItem::create(viewController->getTitle()));
489 }
490 if (m_pViewControllers.empty())
491 {
492 viewController->getNavigationBarItem()->setShowGoBackButton(false);
493 }
494 navigationBar->setItem(viewController->getNavigationBarItem());
495
496 if (m_pNavigationBarBackgroundImage)
497 {
498 navigationBar->setBackgroundView(CAScale9ImageView::createWithImage(m_pNavigationBarBackgroundImage));
499 }
500 else
501 {
502 navigationBar->setBackgroundView(CAView::create());
503 }
504 navigationBar->getBackgroundView()->setColor(m_sNavigationBarBackgroundColor);
505 navigationBar->setTitleColor(m_sNavigationBarTitleColor);
506 navigationBar->setTitleColor(m_sNavigationBarTitleColor);
507 container->insertSubview(navigationBar, 1);
508 navigationBar->setDelegate(this);
509 m_pNavigationBars.pushBack(navigationBar);
510
511 DLayout secondLayout;
512 secondLayout.horizontal = DHorizontalLayoutFill;
513 secondLayout.vertical = DVerticalLayout_T_B(navLayout.vertical.top + navLayout.vertical.height, 0);
514
515 CAView* secondContainer = new CAView();
516 secondContainer->setLayout(secondLayout);
517 container->addSubview(secondContainer);
518 secondContainer->release();
519 m_pSecondContainers.pushBack(secondContainer);

Callers 3

viewDidLoadMethod · 0.95
replaceViewControllerMethod · 0.95
pushViewControllerMethod · 0.95

Calls 15

createWithImageFunction · 0.85
DVerticalLayout_T_BFunction · 0.85
setLayoutMethod · 0.80
getViewMethod · 0.80
setNavigationBarItemMethod · 0.80
setShowGoBackButtonMethod · 0.80
addViewFromSuperviewMethod · 0.80
addSubviewMethod · 0.45
releaseMethod · 0.45
compareMethod · 0.45
emptyMethod · 0.45
setItemMethod · 0.45

Tested by

no test coverage detected