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


C++ CAImageView::setTouchEnabled方法代码示例

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


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

示例1: initPageView

/*
void MainViewController::initPageView()
{
}
*/
void MainViewController::showAlert()
{
    if (p_alertView) {
        this->getView()->removeSubview(p_alertView);
        p_alertView = NULL;
    }
    
    p_alertView = CAView::createWithFrame(DRect((0), (120), m_winSize.width, m_winSize.height - (220)));
    this->getView()->addSubview(p_alertView);
    
    CAImageView* bg = CAImageView::createWithFrame(DRect((0), (0), m_winSize.width, m_winSize.height - (220)));
    bg->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
    bg->setImage(CAImage::create("common/bg.png"));
    bg->setTouchEnabled(false);
    
    CAButton* btn5 = CAButton::create(CAButtonTypeSquareRect);
    btn5->setTag(100);
    btn5->setFrame(DRect((0), (0), m_winSize.width, m_winSize.height - (220)));
    btn5->setTitleColorForState(CAControlStateNormal, CAColor_white);
    btn5->setBackgroundViewForState(CAControlStateNormal, bg);
    btn5->setBackgroundViewForState(CAControlStateHighlighted, bg);
    btn5->addTarget(this, CAControl_selector(MainViewController::buttonCallBack), CAControlEventTouchUpInSide);
    p_alertView->addSubview(btn5);
    
    CALabel* test = CALabel::createWithFrame(DRect(0, m_winSize.height - (300), m_winSize.width, (40)));
    test->setColor(CAColor_gray);
    test->setTextAlignment(CATextAlignmentCenter);
    test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
    test->setFontSize((30));
    test->setText("Network cannot connect!");
    p_alertView->addSubview(test);
    
}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:38,代码来源:MainViewController.cpp

示例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);
             }
//.........这里部分代码省略.........
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:101,代码来源:MainViewController.cpp


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