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


C++ CAScale9ImageView::setCapInsets方法代码示例

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


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

示例1: showSelectedIndicatorView

void CATabBar::showSelectedIndicatorView()
{
    m_pContentView->removeSubview(m_pSelectedIndicatorView);
    if (m_pSelectedIndicatorImage)
    {
        CAScale9ImageView* imageView = CAScale9ImageView::createWithImage(m_pSelectedIndicatorImage);
        CCRect insetRect;
        insetRect.origin = m_pSelectedIndicatorImage->getContentSize() / 2;
        insetRect.origin = ccpSub(insetRect.origin, CCPoint(1, 1));
        insetRect.size = CCPoint(2, 2);
        imageView->setCapInsets(insetRect);
        m_pSelectedIndicatorView = imageView;
    }
    else
    {
        m_pSelectedIndicatorView = CAView::createWithColor(m_sSelectedIndicatorColor);
    }
    
    CADipRect rect;
    rect.size.width = m_cItemSize.width;
    rect.size.height = 8;
    rect.origin.x = m_nSelectedIndex * m_cItemSize.width;
    rect.origin.y = m_cItemSize.height - rect.size.height;
    m_pSelectedIndicatorView->setFrame(rect);
    m_pContentView->insertSubview(m_pSelectedIndicatorView, 1);
    m_pSelectedIndicatorView->setVisible(m_bShowIndicator);
}
开发者ID:nightdomain,项目名称:CrossApp,代码行数:27,代码来源:CABar.cpp

示例2: viewDidLoad

void SiteViewController::viewDidLoad()
{
    // Do any additional setup after loading the view from its nib.
    m_winSize = this->getView()->getBounds().size;

	CAScale9ImageView* tabBg = CAScale9ImageView::createWithImage(CAImage::create("common/yellow_bg.png"));
	tabBg->setCapInsets(DRect(1, 1, 1, 1));
	tabBg->setFrame(DRect((0), (0), m_winSize.width, (150)));
	this->getView()->addSubview(tabBg);

    CAButton* button = CAButton::createWithFrame(DRect((0), (20), (100), (100)), CAButtonTypeCustom);
    CAImageView* imageView = CAImageView::createWithImage(CAImage::create("common/nav_back.png"));
    imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
    imageView->setFrame(DRect((20), (20), (80), (80)));
    button->setBackgroundViewForState(CAControlStateAll, imageView);
    button->addTarget(this, CAControl_selector(SiteViewController::buttonCallBack), CAControlEventTouchUpInSide);
    button->setTag(20);
    this->getView()->addSubview(button);

	CALabel* mc = CALabel::createWithFrame(DRect((120), (62), (200), (50)));
	mc->setFontSize((40));
	mc->setText("Site");
	mc->setColor(CAColor_white);
	mc->setFontName(SAP_FONT_ARIAL);
	this->getView()->addSubview(mc);

    imageView = CAImageView::createWithFrame(DRect(0, (150), m_winSize.width, m_winSize.height - (150)));
    imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
    imageView->setImage(CAImage::create("common/site_map.png"));
    this->getView()->addSubview(imageView);
    
	button = CAButton::createWithFrame(DRect(m_winSize.width - 100, (50), (50), (50)), CAButtonTypeRoundedRect);
	imageView = CAImageView::createWithImage(CAImage::create("common/share_btn.png"));
	imageView->setImageViewScaleType(CAImageViewScaleTypeFitViewByHorizontal);
	button->setTag(200);
	button->setBackgroundViewForState(CAControlStateAll, imageView);
	button->addTarget(this, CAControl_selector(SiteViewController::buttonCallBack), CAControlEventTouchUpInSide);
	this->getView()->addSubview(button);

	requestMsg();
	m_pLoading = CAActivityIndicatorView::createWithCenter(DRect(m_winSize.width / 2, m_winSize.height / 2, 50, 50));
	m_pLoading->setLoadingMinTime(0.5f);
	this->getView()->addSubview(m_pLoading);

    CCLog("%f", CAApplication::getApplication()->getWinSize().width);
}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:46,代码来源:SiteViewController.cpp


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