本文整理汇总了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);
}
示例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);
}