当前位置: 首页>>代码示例>>C++>>正文


C++ CAVector::pushBack方法代码示例

本文整理汇总了C++中CAVector::pushBack方法的典型用法代码示例。如果您正苦于以下问题:C++ CAVector::pushBack方法的具体用法?C++ CAVector::pushBack怎么用?C++ CAVector::pushBack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAVector的用法示例。


在下文中一共展示了CAVector::pushBack方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadTabBarView

CAView* HeroInfoController::loadTabBarView(){


	CAVector<CATabBarItem*> items;
	if (m_pTabBar == NULL){
		CATabBarItem* tabBarItem1 = CATabBarItem::create(UTF8("英雄综合"), NULL, NULL);
		CATabBarItem* tabBarItem2 = CATabBarItem::create(UTF8("技能加点"), NULL, NULL);
		CATabBarItem* tabBarItem3 = CATabBarItem::create(UTF8("物品出装"), NULL, NULL);
		CATabBarItem* tabBarItem4 = CATabBarItem::create(UTF8("克制关系"), NULL, NULL);
		items.pushBack(tabBarItem1);
		items.pushBack(tabBarItem2);
		items.pushBack(tabBarItem3);
		items.pushBack(tabBarItem4);
	}
	m_pTabBar = CATabBar::create(items, CCSize(640, 30));
	m_pTabBar->setTitleColorForNormal(CAColor_gray);
	m_pTabBar->setTitleColorForSelected(CAColor_white);

	m_pTabBar->setSelectedAtIndex(0);
	m_pTabBar->setBackGroundColor(CAColor_black);
	m_pTabBar->setSelectedBackGroundColor(CAColor_black);
	m_pTabBar->setSelectedIndicatorImage(CAImage::create("image/Indicator.png"));
	m_pTabBar->showSelectedIndicator();
	m_pTabBar->setDelegate(this);
	m_pTabBar->setCenterOrigin(CCPoint(320, _size.height / 4 - _px(15)));

	this->getView()->insertSubview(m_pTabBar, 2);
	return m_pTabBar;
}
开发者ID:a752602882,项目名称:DotaMax,代码行数:29,代码来源:HeroInfoController.cpp

示例2: loadTableView

void HeroInfoController::loadTableView(){
	CCRect tableViewRect = this->getView()->getBounds();
	tableViewRect.origin.y = tableViewRect.size.height / 4;
	tableViewRect.size.height = tableViewRect.size.height / 4 * 3;

	m_pPageView = CAPageView::createWithFrame(tableViewRect, CAPageViewDirection::CAPageViewDirectionHorizontal);
	m_pPageView->setPageViewDelegate(this);
	//m_pPageView->setZoomScale(0.2);
	this->getView()->addSubview(m_pPageView);




	m_pTableView1 = CATableView::createWithFrame(tableViewRect);
	m_pTableView1->setTableViewDelegate(this);
	m_pTableView1->setTableViewDataSource(this);
	m_pTableView1->setTableHeaderView(CAView::createWithColor(CAColor_red));
	m_pTableView1->setTableHeaderHeight(_px(20));
	m_pTableView1->setZoomScale(1);

	m_pTableView1->setBackGroundColor(COLOR_GRAY);
	m_pTableView1->setSeparatorColor(COLOR_GRAY1);
	m_pTableView1->setAlwaysTopSectionHeader(false);


	tableViewRect.origin.x += tableViewRect.size.width;
	m_pTableView2 = CATableView::createWithFrame(tableViewRect);
	m_pTableView2->setTableViewDelegate(this);
	m_pTableView2->setTableViewDataSource(this);
	m_pTableView2->setBackGroundColor(COLOR_GRAY);
	m_pTableView2->setSeparatorColor(COLOR_GRAY1);
	m_pTableView2->setAlwaysTopSectionHeader(false);


	tableViewRect.origin.x += tableViewRect.size.width;
	m_pTableView3 = CATableView::createWithFrame(tableViewRect);
	m_pTableView3->setTableViewDelegate(this);
	m_pTableView3->setTableViewDataSource(this);
	m_pTableView3->setBackGroundColor(COLOR_GRAY);
	m_pTableView3->setSeparatorColor(COLOR_GRAY1);
	m_pTableView3->setAlwaysTopSectionHeader(false);

	tableViewRect.origin.x += tableViewRect.size.width;
	m_pTableView4 = CATableView::createWithFrame(tableViewRect);
	m_pTableView4->setTableViewDelegate(this);
	m_pTableView4->setTableViewDataSource(this);
	m_pTableView4->setBackGroundColor(COLOR_GRAY);
	m_pTableView4->setSeparatorColor(COLOR_GRAY1);
	m_pTableView4->setAlwaysTopSectionHeader(false);

	//把CAView中的tableView设置到view中
	CAVector<CAView*> views;
	views.pushBack(m_pTableView1);
	views.pushBack(m_pTableView2);
	views.pushBack(m_pTableView3);
	views.pushBack(m_pTableView4);
	m_pPageView->setViews(views);

}
开发者ID:a752602882,项目名称:DotaMax,代码行数:59,代码来源:HeroInfoController.cpp

示例3: initNewsPageView

void CDNewsViewController::initNewsPageView()
{
    //初始化pageView
    CAView* tempview = CAView::create();
    
    p_PageView = CAPageView::createWithFrame(DRect(0,0,winSize.width,winSize.width/2), CAPageViewDirectionHorizontal);
    p_PageView->setPageViewDelegate(this);
    p_PageView->setTouchEnabled(true);
    CAVector<CAView* > viewList;
    CommonUrlImageView* temImage0 = CommonUrlImageView::createWithFrame(DRect(winSize.width/2,100,winSize.width,winSize.width/2));
    temImage0->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
    temImage0->setImage(CAImage::create("image/HelloWorld.png"));
    temImage0->setUrl(m_page[m_page.size()-1].m_pic);
    
    viewList.pushBack(temImage0);
    for (int i=0; i<m_page.size(); i++) {
        //初始化viewList
        CommonUrlImageView* temImage = CommonUrlImageView::createWithFrame(DRect(winSize.width/2,100,winSize.width,winSize.width/2));
        temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
        temImage->setImage(CAImage::create("image/HelloWorld.png"));
        temImage->setUrl(m_page[i].m_pic);
        viewList.pushBack(temImage);
    }
    CommonUrlImageView* temImage1 = CommonUrlImageView::createWithFrame(DRect(winSize.width/2,100,winSize.width,winSize.width/2));
    temImage1->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
    temImage1->setImage(CAImage::create("image/HelloWorld.png"));
    temImage1->setUrl(m_page[0].m_pic);
    viewList.pushBack(temImage1);
    
    p_PageView->setViews(viewList);
    tempview->addSubview(p_PageView);
    p_PageView->setCurrPage(1, false);
    pageControl = CAPageControl::createWithCenter(DRect(winSize.width-80, winSize.width/2-25, 100, 50));
    pageControl->setNumberOfPages((int)m_page.size());
    pageControl->setPageIndicatorImage(CAImage::create("image/pagecontrol_selected.png"));
    pageControl->setCurrIndicatorImage(CAImage::create("image/pagecontrol_bg.png"));
    pageControl->setPageIndicatorTintColor(CAColor_gray);
    //pageControl->setCurrentPageIndicatorTintColor(CAColor_clear);
    pageControl->addTarget(this, CAControl_selector(CDNewsViewController::pageControlCallBack));
    tempview->addSubview(pageControl);
    
    CAView* bg = CAView::createWithColor(ccc4(0, 0, 0, 128));
    bg->setFrame(DRect(0,winSize.width/2-50,winSize.width,50));
    tempview->addSubview(bg);
    
    if (m_page.size()>0) {
        pageViewTitle = CALabel::createWithFrame(DRect(10, winSize.width/2-40, winSize.width-50, 50));
        pageViewTitle->setText(m_page[0].m_title);
		pageViewTitle->setColor(CAColor_white);
        pageViewTitle->setFontSize(_px(28));
        tempview->addSubview(pageViewTitle);
    }
    
    p_TableView->setTableHeaderView(tempview);
    p_TableView->setTableHeaderHeight(_px(winSize.width/2));
}
开发者ID:bazhi,项目名称:CrossApp,代码行数:56,代码来源:CDNewsViewController.cpp

示例4: initPageView

void MainViewController::initPageView()
{
    int pageViewHeight = m_winSize.height * 0.3;
    int headerHeight = (120);
    // Page view
    if (m_pageView == NULL)
    {
        m_pageView = CAPageView::createWithFrame(DRect(0, headerHeight, m_winSize.width, pageViewHeight), CAPageViewDirectionHorizontal);
        m_pageView->setPageViewDelegate(this);
        m_pageView->setTouchEnabled(true);
        m_pageView->setSpacing(0);
        this->getView()->addSubview(m_pageView);
    }
    
    if (m_pageView) {
        CAVector<CAView* > viewList;
        for (int i = 0; i<m_page.size(); i++)
        {
            CommonUrlImageView* temImage = CommonUrlImageView::createWithFrame(DRect(0, (0), m_winSize.width, pageViewHeight - headerHeight));
            temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
            temImage->setImage(CAImage::create("common/bg.png"));
            temImage->setUrl(m_page[i].m_imageUrl);
            temImage->setTouchEnabled(true);
            temImage->setTag(500 + i);
            viewList.pushBack(temImage);
        }
        m_pageView->setViews(viewList);
        m_pageView->setCurrPage(0, false);
    }
    
    // picture dots bg in page view
    if (m_pageControlBG == NULL) {
        m_pageControlBG = CAView::createWithColor(ccc4(0, 0, 0, 20));
        m_pageControlBG->setFrame(DRect(0, pageViewHeight + headerHeight - (50), m_winSize.width, (50)));
        m_pageControlBG->setTouchEnabled(false);
        this->getView()->addSubview(m_pageControlBG);
    }
    
    // picture dots
    if (m_pageControl != NULL) {
        this->getView()->removeSubview(m_pageControl);
        m_pageControl = NULL;
    }
    m_pageControl = CAPageControl::createWithCenter(DRect(m_winSize.width / 2, pageViewHeight + headerHeight - (25), (200), (50)));
    m_pageControl->setTag(200);
    m_pageControl->setTouchEnabled(false);
    m_pageControl->addTarget(this, CAControl_selector(MainViewController::buttonCallBack));
    m_pageControl->setNumberOfPages((int)m_page.size());
    this->getView()->addSubview(m_pageControl);
    
    // to : animate the page view
    CAScheduler::schedule(schedule_selector(MainViewController::updatePageView), this, 5);//, true, 3000);
}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:53,代码来源:MainViewController.cpp

示例5: viewDidLoad

void CATabBarController::viewDidLoad()
{
    std::vector<CATabBarItem*> items;
    
    for (unsigned int i=0; i<m_pViewControllers.size(); i++)
    {
        CAViewController* view = m_pViewControllers.at(i);
        if (view->getTabBarItem() == NULL)
        {
            char title[8];
            sprintf(title, "item%d", i);
            CATabBarItem* item = CATabBarItem::create(title, NULL);
            item->setTag(i);
            view->setTabBarItem(item);
        }
        items.push_back(view->getTabBarItem());
        view->m_pTabBarController = this;
    }
    
    m_pTabBar = CATabBar::create(items, DSize(this->getView()->getBounds().size.width, 0), m_eTabBarVerticalAlignment);
    this->getView()->addSubview(m_pTabBar);
    m_pTabBar->setDelegate(this);
    
    DRect container_rect = this->getView()->getBounds();
    
    DPoint tab_bar_rectOrgin = DPointZero;
    if (m_bTabBarHidden)
    {
        tab_bar_rectOrgin = this->getTabBarTakeBackPoint();
    }
    else
    {
        tab_bar_rectOrgin = this->getTabBarOpenPoint();
        
        container_rect.size.height -= m_pTabBar->getFrame().size.height;
        if (m_eTabBarVerticalAlignment == CABarVerticalAlignmentTop)
        {
            container_rect.origin.y = m_pTabBar->getFrame().size.height;
        }
    }
    
    DSize container_view_size = container_rect.size;
    container_view_size.width *= m_pViewControllers.size();
    
    m_pContainer = CAPageView::createWithFrame(container_rect, CAPageViewDirectionHorizontal);
    m_pContainer->setBackgroundColor(CAColor_clear);
    m_pContainer->setPageViewDelegate(this);
    m_pContainer->setScrollViewDelegate(this);
    m_pContainer->setScrollEnabled(m_bScrollEnabled);
    m_pContainer->setDisplayRange(true);
    this->getView()->addSubview(m_pContainer);
    
    CAVector<CAView*> views;
    for (int i=0; i<m_pViewControllers.size(); i++)
    {
        CAView* view = new CAView();
        views.pushBack(view);
        view->release();
    }
    m_pContainer->setViews(views);
    
    if (m_pTabBarBackgroundImage)
    {
        m_pTabBar->setBackgroundImage(m_pTabBarBackgroundImage);
    }
    else
    {
        m_pTabBar->setBackgroundColor(m_sTabBarBackgroundColor);
    }
    
    
    if (m_pTabBarSelectedBackgroundImage)
    {
        m_pTabBar->setSelectedBackgroundImage(m_pTabBarSelectedBackgroundImage);
    }
    else
    {
        m_pTabBar->setSelectedBackgroundColor(m_sTabBarSelectedBackgroundColor);
    }
    
    
    if (m_pTabBarSelectedIndicatorImage)
    {
        m_pTabBar->setSelectedIndicatorImage(m_pTabBarSelectedIndicatorImage);
    }
    else
    {
        m_pTabBar->setSelectedIndicatorColor(m_sTabBarSelectedIndicatorColor);
    }
    
    
    m_pTabBar->setTitleColorForNormal(m_sTabBarTitleColor);
    m_pTabBar->setTitleColorForSelected(m_sTabBarSelectedTitleColor);
    
    if (m_bShowTabBarSelectedIndicator)
    {
        m_pTabBar->showSelectedIndicator();
    }
    
    m_pTabBar->setFrameOrigin(tab_bar_rectOrgin);
//.........这里部分代码省略.........
开发者ID:wjm0729,项目名称:CrossApp,代码行数:101,代码来源:CAViewController.cpp

示例6: init

bool RootWindow::init()
{
    if (!CAWindow::init())
    {
        return false;
    }
    CAApplication::getApplication()->setNotificationView(CAView::createWithFrame(this->getBounds(), CAColor_green));

    CAVector<CAViewController*> controllerVec;
	m_home = new MainViewController();
    if (m_home) {
        m_home->setTabBarItem(CATabBarItem::create(unicode_to_utf8(mainBar[0]), CAImage::create("main/bar_0.png"),CAImage::create("main/bar_pre_0.png")));
        m_home->init();
        m_home->autorelease();
        controllerVec.pushBack(m_home);
    }
    
    m_session = new SessionsViewController();
    if (m_session) {
        m_session->init();
        m_session->autorelease();
        m_session->setTabBarItem(CATabBarItem::create(unicode_to_utf8(mainBar[1]), CAImage::create("main/bar_1.png"),CAImage::create("main/bar_pre_1.png")));
        controllerVec.pushBack(m_session);
    }
    
    m_my = new MyStatusViewController();
    if (m_my) {
        m_my->setTabBarItem(CATabBarItem::create(unicode_to_utf8(mainBar[2]), CAImage::create("main/bar_2.png"),CAImage::create("main/bar_pre_2.png")));
        m_my->init();
        m_my->autorelease();
        controllerVec.pushBack(m_my);
    }    
    
    CATabBarController* tabBarController = new CATabBarController();
    tabBarController->initWithViewControllers(controllerVec);
    tabBarController->setTabBarSelectedBackgroundColor(CAColor_clear);
    tabBarController->setTabBarTitleColorForSelected(CAColor_white);

    tabBarController->setTabBarBackgroundImage(CAImage::create("common/sky_bg.png"));
    /*
    CANavigationBarItem* temp_nav = CANavigationBarItem::create("");
    temp_nav->setNagigationBarHidden(true);
	tabBarController->setScrollEnabled(false);
    tabBarController->setNavigationBarItem(temp_nav);
    tabBarController->setTabBarTitleColorForSelected(CAColor_white);
    tabBarController->autorelease();
*/
	m_pRootNavigationController = new CANavigationController();
	m_pRootNavigationController->initWithRootViewController(tabBarController);
	m_pRootNavigationController->setNavigationBarBackgroundImage(CAImage::create("common/sky_bg.png"));
	m_pRootNavigationController->setNavigationBarHidden(true, false);
    m_pRootNavigationController->setScrollEnabled(false);

    FUser user = FUserManager::sharedFUserManager()->onLineUser();
	if (user.loginname.length() == 0)
	{
		LoginViewController* _viewController = new LoginViewController();
		_viewController->init();
		this->setRootViewController(_viewController);
		_viewController->release();
	}
	else
	{
        FDataManager::getInstance()->setUserId(user.uid);
		this->setRootViewController(m_pRootNavigationController);
	}

	CAApplication::getApplication()->setNotificationView(NULL);
    
    return true;
}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:71,代码来源:RootWindow.cpp

示例7: initNewsImageView

void CDShowNewsImage::initNewsImageView(newsImage _image)
{
    m_image = _image;
    CAVector<CAView* > viewList;

    for (int i=0; i<m_image.m_imageUrl.size(); i++) {
        //初始化viewList
        CommonUrlImageView* temImage = CommonUrlImageView::createWithFrame(DRect(0,0,winSize.width,winSize.height));
        temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageInside);
        temImage->setImage(CAImage::create("HelloWorld.png"));
        temImage->setUrl(m_image.m_imageUrl[i]);
        
        CAScrollView* p_ScrollView = CAScrollView::createWithFrame(DRect(0,0,winSize.width,winSize.height));
        p_ScrollView->setMinimumZoomScale(1.0f);
        p_ScrollView->setMaximumZoomScale(2.5f);
        p_ScrollView->setMultitouchGesture(CAScrollView::MultitouchGesture::Zoom);
        p_ScrollView->setBackgroundColor(CAColor_clear);
        p_ScrollView->setShowsScrollIndicators(false);
        p_ScrollView->setBounceVertical(false);
        p_ScrollView->setScrollViewDelegate(this);
        p_ScrollView->addSubview(temImage);
        viewList.pushBack(p_ScrollView);
    }
    p_PageView = CAPageView::createWithFrame(DRect(0, 30, winSize.width, winSize.height), CAPageViewDirectionHorizontal);
    p_PageView->setViews(viewList);
    p_PageView->setPageViewDelegate(this);
    p_PageView->setBackgroundColor(CAColor_black);
    p_PageView->setPageViewDelegate(this);
    this->getView()->addSubview(p_PageView);
    
    p_bg = CAView::createWithColor(ccc4(0,0,0,200));
    p_bg->setFrame(DRect(0,winSize.height/3*2,winSize.width,winSize.height/2));
    this->getView()->addSubview(p_bg);

    p_title = CALabel::createWithFrame(DRect(10,10,winSize.width-80,40));
    p_title->setText(m_image.m_title);
	p_title->setColor(CAColor_white);
    p_title->setFontSize(34);
    p_title->setBold(true);
    p_bg->addSubview(p_title);
    
    char temp[10];
    sprintf(temp, "1/%lu",m_image.m_imageUrl.size());
    p_index = CALabel::createWithFrame(DRect(winSize.width-60,10,80,30));
    p_index->setText(temp);
	p_index->setColor(CAColor_white);
    p_index->setFontSize(30);
    p_index->setBold(true);
    p_bg->addSubview(p_index);
    
    p_des = CALabel::createWithFrame(DRect(10,0,winSize.width-20,200));
    p_des->setText(m_image.m_imageDesc[4]);
	p_des->setColor(ccc4(200, 200, 200, 255));
    p_des->setFontSize(26);
    
    CAScrollView* ps = CAScrollView::createWithFrame(DRect(0,70,winSize.width,200));
    ps->setBackgroundColor(CAColor_clear);
    ps->setShowsVerticalScrollIndicator(false);
    ps->setShowsHorizontalScrollIndicator(false);
    ps->setBounceHorizontal(false);
    ps->addSubview(p_des);
    p_bg->addSubview(ps);

}
开发者ID:jtly1985,项目名称:CrossApp,代码行数:64,代码来源:CDShowNewsImage.cpp

示例8: viewDidLoad

void CATabBarController::viewDidLoad()
{
    CCPoint tab_bar_rectOrgin = CCPointZero;
    
    CCRect container_rect = this->getView()->getBounds();
    
    CCSize container_view_size = container_rect.size;
    container_view_size.width *= m_pViewControllers.size();
    
    if (m_bTabBarHidden)
    {
        tab_bar_rectOrgin = this->getTabBarTakeBackPoint();
    }
    else
    {
        tab_bar_rectOrgin = this->getTabBarOpenPoint();
        
        container_rect.size.height -= m_pTabBar->getFrame().size.height;
        if (m_eTabBarVerticalAlignment == CABarVerticalAlignmentTop)
        {
            container_rect.origin.y = m_pTabBar->getFrame().size.height;
        }
    }
    
    m_pContainer = CAPageView::createWithFrame(container_rect, CAPageView::CAPageViewDirectionHorizontal);
    m_pContainer->setBackGroundColor(CAColor_clear);
    m_pContainer->setPageViewDelegate(this);
    m_pContainer->setScrollViewDelegate(this);
    m_pContainer->setScrollEnabled(m_bscrollEnabled);
    m_pContainer->setDisplayRange(true);
    this->getView()->addSubview(m_pContainer);
    
    CAVector<CAView*> views;
    for (int i=0; i<m_pViewControllers.size(); i++)
    {
        CAView* view = new CAView();
        views.pushBack(view);
        view->release();
    }
    m_pContainer->setViews(views);
    
    if (m_pTabBarBackGroundImage)
    {
        m_pTabBar->setBackGroundImage(m_pTabBarBackGroundImage);
    }
    else
    {
        m_pTabBar->setBackGroundColor(m_sTabBarBackGroundColor);
    }
    
    
    if (m_pTabBarSelectedBackGroundImage)
    {
        m_pTabBar->setSelectedBackGroundImage(m_pTabBarSelectedBackGroundImage);
    }
    else
    {
        m_pTabBar->setSelectedBackGroundColor(m_sTabBarSelectedBackGroundColor);
    }
    
    
    if (m_pTabBarSelectedIndicatorImage)
    {
        m_pTabBar->setSelectedIndicatorImage(m_pTabBarSelectedIndicatorImage);
    }
    else
    {
        m_pTabBar->setSelectedIndicatorColor(m_sTabBarSelectedBackGroundColor);
    }
    
    
    m_pTabBar->setTitleColorForNormal(m_sTabBarTitleColor);
    m_pTabBar->setTitleColorForSelected(m_sTabBarSelectedTitleColor);
    
    if (m_bShowTabBarSelectedIndicator)
    {
        m_pTabBar->showSelectedIndicator();
    }
    
    m_pTabBar->setFrameOrigin(tab_bar_rectOrgin);
    this->getView()->addSubview(m_pTabBar);
    
    m_pTabBar->setSelectedAtIndex(m_nSelectedIndex);
    this->renderingSelectedViewController();
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:85,代码来源:CAViewController.cpp

示例9: tableViewSectionViewForHeaderInSection

CAView* HeroViewController::tableViewSectionViewForHeaderInSection(CATableView* table, const CCSize& viewSize, unsigned int section)
{
	if (section ==0)
	{
		return NULL;
	}
	m_pClassView = CAView::createWithColor(COLOR_GRAY);

	CALabel* label = CALabel::createWithFrame(CCRect(10,0,viewSize.width/10,viewSize.height));
	label->setTextAlignment(CATextAlignmentLeft);
	label->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
	label->setText(UTF8("本地数据"));
	label->setFontSize(_px(13));
	m_pClassView->addSubview(label);

// 	m_pSegmented = CASegmentedControl::createWithFrame(CCRect(viewSize.width/10*6,_px(0),viewSize.width/10*3,viewSize.height/2),4);
// 	//m_pSegmented->setSegmentItemBackgroundImage()
// 	//m_pSegmented->setContentOffsetForSegmentAtIndex()
// 	
// 	m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/All_Class.png"), 0, CAControlStateNormal);
// 	m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/All_Class1.png"), 0, CAControlStateSelected);
// 	m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Power_Class.png"), 1, CAControlStateNormal);
// 	m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Power_Class1.png"), 1, CAControlStateSelected);
// 	m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Agile_Class.png"), 2, CAControlStateNormal);
// 	m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Agile_Class1.png"), 2, CAControlStateSelected);
// 	m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Puzzle_Class.png"), 3, CAControlStateNormal);
// 	m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Puzzle_Class1.png"), 3, CAControlStateSelected);
// 	m_pSegmented->setBackgroundView(CAView::createWithColor(COLOR_GRAY));
// 	m_pSegmented->setBackgroundImage(NULL);
// 	m_pSegmented->setSelectedAtIndex(0);
// 
// 	//m_pSegmented->addTarget()
// 	m_pClassView->addSubview(m_pSegmented);
	

	CAVector<CATabBarItem*> items;
	
		CATabBarItem* tabBarItem1 = CATabBarItem::create("", CAImage::create("hero/All_Class.png"),
			CAImage::create("hero/All_Class1.png"));
		CATabBarItem* tabBarItem2 = CATabBarItem::create("", CAImage::create("hero/Power_Class.png"),
			CAImage::create("hero/Power_Class1.png"));
		CATabBarItem* tabBarItem3 = CATabBarItem::create("", CAImage::create("hero/Agile_Class.png"),
			CAImage::create("hero/Agile_Class1.png"));
		CATabBarItem* tabBarItem4 = CATabBarItem::create("", CAImage::create("hero/Puzzle_Class.png"),
			CAImage::create("hero/Puzzle_Class1.png"));

		items.pushBack(tabBarItem1);
		items.pushBack(tabBarItem2);
		items.pushBack(tabBarItem3);
		items.pushBack(tabBarItem4);
	
	m_pClassTabBar = CATabBar::create(items, CCSize(160, 40));
	m_pClassTabBar->setTag(101);
	
	m_pClassTabBar->setSelectedAtIndex(selectNum);
	m_pClassTabBar->setBackGroundColor(COLOR_GRAY);
	m_pClassTabBar->setSelectedBackGroundColor(COLOR_GRAY);
	m_pClassTabBar->setDelegate(this);
	m_pClassTabBar->setCenterOrigin(CCPoint(viewSize.width / 10 * 8, _px(viewSize.height / 2)));

	m_pClassView->addSubview(m_pClassTabBar);


	return m_pClassView;
}
开发者ID:a752602882,项目名称:DotaMax,代码行数:65,代码来源:HeroViewController.cpp

示例10: initNewsImageView

void CDShowNewsImage::initNewsImageView(newsImage _image)
{
    m_image = _image;
    
    CAVector<CAView* > viewList;
    for (int i=0; i<m_image.m_imageUrl.size(); i++)
    {
        CommonUrlImageView* temImage = CommonUrlImageView::createWithLayout(DLayoutFill);
        temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageInside);
        temImage->setImage(CAImage::create("HelloWorld.png"));
        temImage->setUrl(m_image.m_imageUrl[i]);
        
        CAScrollView* p_ScrollView = CAScrollView::createWithLayout(DLayoutFill);
        p_ScrollView->setMinimumZoomScale(1.0f);
        p_ScrollView->setMaximumZoomScale(2.5f);
        p_ScrollView->setMultitouchGesture(CAScrollView::MultitouchGesture::Zoom);
        p_ScrollView->setBackgroundColor(CAColor_clear);
        p_ScrollView->setShowsScrollIndicators(false);
        p_ScrollView->setBounceVertical(false);
        p_ScrollView->setScrollViewDelegate(this);
        p_ScrollView->addSubview(temImage);
        viewList.pushBack(p_ScrollView);
    }
    
    p_PageView = CAPageView::createWithLayout(DLayoutFill, CAPageView::Horizontal);
    p_PageView->setViews(viewList);
    p_PageView->setPageViewDelegate(this);
    p_PageView->setBackgroundColor(CAColor_black);
    p_PageView->setPageViewDelegate(this);
    p_PageView->setSpacing(40);
    this->getView()->addSubview(p_PageView);
    
    p_bg = CAView::createWithColor(ccc4(0,0,0,200));
    p_bg->setLayout(DLayout(DHorizontalLayoutFill, DVerticalLayout_B_C(0, 0.85)));
    this->getView()->addSubview(p_bg);

    p_title = CALabel::createWithLayout(DLayout(DHorizontalLayout_L_R(10, 80), DVerticalLayout_T_H(10, 50)));
    p_title->setText(m_image.m_title);
	p_title->setColor(CAColor_white);
    p_title->setFontSize(34);
    p_title->setBold(true);
    p_bg->addSubview(p_title);
    
    char temp[10];
    sprintf(temp, "1/%lu",m_image.m_imageUrl.size());
    p_index = CALabel::createWithLayout(DLayout(DHorizontalLayout_R_W(0, 70), DVerticalLayout_T_H(10, 50)));
    p_index->setText(temp);
	p_index->setColor(CAColor_white);
    p_index->setFontSize(30);
    p_index->setBold(true);
    p_bg->addSubview(p_index);
    
    p_des = CALabel::createWithLayout(DLayout(DHorizontalLayout_L_R(10, 20), DVerticalLayoutFill));
    p_des->setText(m_image.m_imageDesc[4]);
	p_des->setColor(ccc4(200, 200, 200, 255));
    p_des->setFontSize(26);
    
    CAScrollView* ps = CAScrollView::createWithLayout(DLayout(DHorizontalLayoutFill, DVerticalLayout_T_H(70, 200)));
    ps->setBackgroundColor(CAColor_clear);
    ps->setShowsVerticalScrollIndicator(false);
    ps->setShowsHorizontalScrollIndicator(false);
    ps->setBounceHorizontal(false);
    ps->addSubview(p_des);
    p_bg->addSubview(ps);

}
开发者ID:boaass,项目名称:CrossApp,代码行数:66,代码来源:CDShowNewsImage.cpp


注:本文中的CAVector::pushBack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。