Example #1
0
void RootWindow::keyBackClicked()
{
    if (this->getModalViewController())
    {
        this->dismissModalViewController(true);
    }
    else if (this->getDrawerController()->isShowLeftViewController())
    {
        this->getDrawerController()->hideLeftViewController(true);
    }
    else if (this->getRootNavigationController()->getViewControllerCount() > 1)
    {
        this->getRootNavigationController()->popViewControllerAnimated(true);
    }
    else if (this->getRootTabBarController()->getSelectedViewController()->isEqual(m_pSecondNavigationController)
             && this->getSecondNavigationController()->getViewControllerCount() > 1)
    {
        this->getSecondNavigationController()->popViewControllerAnimated(true);
    }
    else
    {
        CC_RETURN_IF(m_bAlertShow);
        m_bAlertShow = true;
        CAAlertView* alertView = CAAlertView::createWithText("提示", "确定要退出?", "确定", "取消", NULL);
        alertView->setTarget(this, CAAlertView_selector(RootWindow::onAlertView));
        alertView->show();
    }
}
Example #2
0
void AlertViewTest::respondTouch(CAControl* btn ,CCPoint point)
{
	CCSize size = this->getView()->getBounds().size;
	std::vector<std::string> btnTitle;
	CAAlertView* alertView = CAAlertView::create();
	btnTitle.push_back("green");
	btnTitle.push_back("yeelow");
	btnTitle.push_back("orange");
	alertView->showMessage("ButtonImage", "What kind of background of button do you like?", btnTitle);
	alertView->setTarget(this, CAAlertView_selector(AlertViewTest::alertViewCallback));
}