本文整理汇总了C++中CAButton::setBackgroundViewForState方法的典型用法代码示例。如果您正苦于以下问题:C++ CAButton::setBackgroundViewForState方法的具体用法?C++ CAButton::setBackgroundViewForState怎么用?C++ CAButton::setBackgroundViewForState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAButton
的用法示例。
在下文中一共展示了CAButton::setBackgroundViewForState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: viewDidLoad
void SessionsViewController::viewDidLoad()
{
// Do any additional setup after loading the view from its nib.
m_winSize = this->getView()->getBounds().size;
CAScale9ImageView* sView = CAScale9ImageView::createWithImage(CAImage::create("common/sky_bg.png"));
sView->setFrame(DRect((0), (0), m_winSize.width, (120)));
this->getView()->addSubview(sView);
CAButton* button = CAButton::createWithFrame(DRect((0), (20), (100), (100)), CAButtonTypeCustom);
CAImageView* imageView = CAImageView::createWithImage(CAImage::create("common/nav_search.png"));
imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
button->setBackgroundViewForState(CAControlStateAll, imageView);
button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(20);
this->getView()->addSubview(button);
FSegmentView* seg = FSegmentView::createWithFrame(DRect(m_winSize.width - 240, 45, 200, 50), 2);
seg->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
imageView = CAImageView::createWithImage(CAImage::create("common/nav_time.png"));
seg->setItemBackgroundImage(imageView, 0);
imageView = CAImageView::createWithImage(CAImage::create("common/nav_type.png"));
seg->setItemBackgroundImage(imageView, 1);
seg->setTag(200, 0);
seg->setTag(201, 1);
this->getView()->addSubview(seg);
m_navType = 0;
m_navTimeType = 0;
m_navFormatType = 0;
CALabel* label = CALabel::createWithCenter(DRect(m_winSize.width / 2, (75), m_winSize.width, (50)));
label->setTextAlignment(CATextAlignmentCenter);
label->setColor(CAColor_white);
label->setFontSize(SAP_TITLE_FONT_SIZE);
label->setText("Agenda");
label->setFontName(SAP_FONT_ARIAL);
sView->addSubview(label);
if (m_msg->empty())
{
requestMsg();
{
p_pLoading = CAActivityIndicatorView::createWithCenter(DRect(m_winSize.width / 2, m_winSize.height / 2, 50, 50));
this->getView()->insertSubview(p_pLoading, CAWindowZOderTop);
p_pLoading->setLoadingMinTime(0.5f);
p_pLoading->setTargetOnCancel(this, callfunc_selector(SessionsViewController::initMsgTableView));
}
}
else
{
initMsgTableView();
}
CCLog("%f", CAApplication::getApplication()->getWinSize().width);
}
示例3: viewDidLoad
void NoticeDetailViewController::viewDidLoad()
{
// Do any additional setup after loading the view from its nib.
m_winSize = this->getView()->getBounds().size;
CAScale9ImageView* sView = CAScale9ImageView::createWithImage(CAImage::create("common/sky_bg.png"));
sView->setFrame(DRect((0), (0), m_winSize.width, (120)));
this->getView()->addSubview(sView);
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(NoticeDetailViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(20);
sView->addSubview(button);
CALabel* label = CALabel::createWithCenter(DRect(m_winSize.width / 2, (70), m_winSize.width, (50)));
label->setTextAlignment(CATextAlignmentCenter);
label->setColor(CAColor_white);
label->setTouchEnabled(false);
label->setFontSize((40));
label->setText("Notice");
label->setFontName(SAP_FONT_ARIAL);
sView->addSubview(label);
label = CALabel::createWithFrame(DRect(0, (200), m_winSize.width, (60)));
label->setTextAlignment(CATextAlignmentCenter);
label->setColor(CAColor_gray);
label->setTouchEnabled(false);
label->setFontSize((40));
label->setText(m_title);
label->setFontName(SAP_FONT_ARIAL);
this->getView()->addSubview(label);
label = CALabel::createWithFrame(DRect(40, (300), m_winSize.width - 80, (800)));
label->setTextAlignment(CATextAlignmentLeft);
label->setColor(CAColor_gray);
label->setTouchEnabled(false);
label->setFontSize((30));
label->setText(m_detail);
label->setFontName(SAP_FONT_ARIAL);
this->getView()->addSubview(label);
CCLog("%f", CAApplication::getApplication()->getWinSize().width);
}
示例4: initMsgTableView
void SessionsViewController::initMsgTableView()
{
if (m_msg->empty())
{
showAlert();
return;
}
if (m_msgTableView == NULL)
{
m_listView = CAListView::createWithFrame(DRect(0,(120),m_winSize.width,(60)));
m_listView->setListViewDelegate(this);
m_listView->setListViewDataSource(this);
m_listView->setAllowsSelection(true);
m_listView->setAllowsMultipleSelection(false);
m_listView->setListViewOrientation(CAListViewOrientationHorizontal);
m_listView->setShowsScrollIndicators(false);
m_listView->setSeparatorColor(ccc4(0xf6, 0xf6, 0xf6, 0xff));
m_listView->setBackgroundImage(CAImage::create("common/gray_bg.png"));
m_listView->setTag(1);
//m_listView->setc
this->getView()->addSubview(m_listView);
m_msgTableView = CATableView::createWithFrame(DRect(0, (180), m_winSize.width, m_winSize.height - (180)));
m_msgTableView->setTableViewDataSource(this);
m_msgTableView->setTableViewDelegate(this);
m_msgTableView->setScrollViewDelegate(this);
m_msgTableView->setAllowsSelection(true);
m_msgTableView->setSeparatorColor(ccc4(200, 200, 200, 80));
//m_msgTableView->setSeparatorViewHeight((2));
this->getView()->addSubview(m_msgTableView);
CAPullToRefreshView *refreshDiscount = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeHeader);
refreshDiscount->setLabelColor(CAColor_black);
m_msgTableView->setHeaderRefreshView(refreshDiscount);
m_filterView = CAView::createWithFrame(DRect(0, (120), m_winSize.width, (60)));
CAScale9ImageView* imageView = CAScale9ImageView::createWithImage(CAImage::create("common/gray_bg.png"));
imageView->setFrame(DRect(0, 0, m_winSize.width, (60)));
m_filterView->addSubview(imageView);
this->getView()->addSubview(m_filterView);
m_filterViewVec.push_back(m_filterView);
for (int i = 0; i < 2; i++)
{
int cnt = 0;
if (i == 0) {
cnt = TrackNum;
} else if (i == 1) {
cnt = FormatNum;
}
m_filterBtn[i] = CAButton::createWithFrame(DRect(i * m_winSize.width / 2, 0, m_winSize.width / 2, (60)), CAButtonTypeCustom);
m_filterBtn[i]->setTitleForState(CAControlStateAll, filterItem[i]);
m_filterBtn[i]->setTitleFontName(SAP_FONT_ARIAL);
m_filterBtn[i]->setTitleFontSize((30));
m_filterBtn[i]->setTitleColorForState(CAControlStateAll, CAColor_gray);
m_filterBtn[i]->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
m_filterBtn[i]->setTag(300 + i);
m_filterBtn[i]->setAllowsSelected(true);
m_filterView->addSubview(m_filterBtn[i]);
m_downView[i] = CAView::createWithFrame(DRect(i * m_winSize.width / 2, (180), m_winSize.width / 2, (50) * cnt + (20)));
CAScale9ImageView* imageView = CAScale9ImageView::createWithImage(CAImage::create("common/gray_bg.png"));
imageView->setFrame(DRect(0, 0, m_winSize.width / 2, (50) * cnt + (20)));
m_downView[i]->addSubview(imageView);
this->getView()->addSubview(m_downView[i]);
m_filterViewVec.push_back(m_downView[i]);
}
for (int i = 0; i < m_filterViewVec.size(); i++)
{
m_filterViewVec[i]->setVisible(false);
}
for (int i = 0; i < TrackNum; i++)
{
CAButton* button = CAButton::createWithFrame(DRect((20), (50) * i, m_winSize.width / 2 - (40), (50)), CAButtonTypeCustom);
button->setTitleForState(CAControlStateAll, trackFilterItem[i]);
button->setTitleFontName(SAP_FONT_ARIAL);
button->setTitleColorForState(CAControlStateAll, CAColor_gray);
button->setTitleColorForState(CAControlStateSelected, CAColor_white);
button->setTitleFontSize((27));
button->setAllowsSelected(true);
//CAImageView* imageView = CAImageView::createWithImage(CAImage::create("common/white_bg.png"));
//button->setBackgroundViewForState(CAControlStateAll, imageView);
CAImageView* imageView = CAImageView::createWithImage(CAImage::create("common/sky_bg.png"));
button->setBackgroundViewForState(CAControlStateSelected, imageView);
button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(400 + i);
m_downView[0]->addSubview(button);
m_trackButtonVec.push_back(button);
}
for (int i = 0; i < FormatNum; i++)
{
CAButton* button = CAButton::createWithFrame(DRect((20), (50) * i, m_winSize.width / 2 - (40), (50)), CAButtonTypeCustom);
button->setTitleForState(CAControlStateAll, formatFilterItem[i]);
button->setTitleFontName(SAP_FONT_ARIAL);
button->setTitleColorForState(CAControlStateAll, CAColor_gray);
button->setTitleColorForState(CAControlStateSelected, CAColor_white);
//.........这里部分代码省略.........