本文整理汇总了C++中CALabel::setTouchEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ CALabel::setTouchEnabled方法的具体用法?C++ CALabel::setTouchEnabled怎么用?C++ CALabel::setTouchEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CALabel
的用法示例。
在下文中一共展示了CALabel::setTouchEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: viewDidLoad
void MainViewController::viewDidLoad()
{
// Do any additional setup after loading the view from its nib.
m_winSize = this->getView()->getBounds().size;
// header
CAScale9ImageView* header = CAScale9ImageView::createWithImage(CAImage::create("common/sky_bg.png"));
if (header) {
header->setFrame(DRect((0), (0), m_winSize.width, (120)));
header->setTouchEnabled(false);
this->getView()->addSubview(header);
// title lable
CALabel* label = CALabel::createWithCenter(DRect(m_winSize.width / 2, (80), m_winSize.width, (50)));
if (label) {
label->setTextAlignment(CATextAlignmentCenter);
label->setColor(CAColor_white);
label->setFontSize(SAP_TITLE_FONT_SIZE);
label->setText("SAP d-kom");
label->setFontName(SAP_FONT_ARIAL);
label->setTouchEnabled(false);
header->addSubview(label);
}
}
// left notification button
CAButton* button = CAButton::createWithFrame(DRect((0), (20), (100), (100)), CAButtonTypeCustom);
if (button) {
button->addTarget(this, CAControl_selector(MainViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(20);
this->getView()->addSubview(button);
CAImageView* imageView = CAImageView::createWithImage(CAImage::create("main/nav_notification.png"));
if (imageView) {
imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
button->setBackGroundViewForState(CAControlStateAll, imageView);
}
m_timeNoticeImageView = CAImageView::createWithFrame(DRect((60), (30), (20), (20)));
if (m_timeNoticeImageView) {
m_timeNoticeImageView->setImage(CAImage::create("common/reddot.png"));
button->addSubview(m_timeNoticeImageView);
}
//refreshNoticeRedPoint();
}
// notification alert point
/*
// right survey button
button = CAButton::createWithFrame(DRect(m_winSize.width - (100), (20), (100), (100)), CAButtonTypeCustom);
if (button) {
button->addTarget(this, CAControl_selector(MainViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(30);
this->getView()->addSubview(button);
CAImageView* imageView = CAImageView::createWithImage(CAImage::create("main/nav_survey.png"));
if (imageView) {
imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
button->setBackgroundViewForState(CAControlStateAll, imageView);
}
}
// survey lable
CALabel * surveylable = CALabel::createWithFrame(DRect(m_winSize.width - (75), (100), (100), (25)));
if (surveylable) {
surveylable->setTextAlignment(CATextAlignmentLeft);
surveylable->setColor(CAColor_white);
surveylable->setFontSize(15);
surveylable->setText("Survey");
surveylable->setFontName(SAP_FONT_ARIAL);
surveylable->setTouchEnabled(false);
this->getView()->addSubview(surveylable);
}
*/
int pageViewHeight = m_winSize.height * 0.3;
int butViewHeight = m_winSize.height * 0.15;
int headerHeight = (120);
int buttitleHeight = (40);
/*
// Page view
if (!m_pageView)
{
m_pageView = CAPageView::createWithFrame(DRect(0, headerHeight, m_winSize.width, pageViewHeight), CAPageViewDirectionHorizontal);
if (m_pageView) {
m_pageView->setPageViewDelegate(this);
m_pageView->setTouchEnabled(true);
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(false);
viewList.pushBack(temImage);
}
//.........这里部分代码省略.........