本文整理汇总了C++中CAButton::addSubview方法的典型用法代码示例。如果您正苦于以下问题:C++ CAButton::addSubview方法的具体用法?C++ CAButton::addSubview怎么用?C++ CAButton::addSubview使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAButton
的用法示例。
在下文中一共展示了CAButton::addSubview方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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(_px(0), _px(0), m_winSize.width, _px(120)));
this->getView()->addSubview(sView);
CAButton* button = CAButton::createWithFrame(DRect(_px(20), _px(20), _px(100), _px(100)), CAButtonTypeCustom);
CAImageView* imageView = CAImageView::createWithImage(CAImage::create("main/nav_notification.png"));
imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
button->setBackGroundViewForState(CAControlStateAll, imageView);
button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(20);
this->getView()->addSubview(button);
m_timeNoticeImageView = CAImageView::createWithFrame(DRect(_px(60), _px(30), _px(10), _px(10)));
m_timeNoticeImageView->setImage(CAImage::create("common/reddot.png"));
button->addSubview(m_timeNoticeImageView);
button = CAButton::createWithFrame(DRect(m_winSize.width - _px(120), _px(20), _px(100), _px(100)), CAButtonTypeCustom);
imageView = CAImageView::createWithImage(CAImage::create("main/nav_prize.png"));
imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
button->setBackGroundViewForState(CAControlStateAll, imageView);
button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(30);
this->getView()->addSubview(button);
CALabel* label = CALabel::createWithCenter(DRect(m_winSize.width / 2, _px(70), m_winSize.width, _px(40)));
label->setTextAlignment(CATextAlignmentCenter);
label->setColor(CAColor_white);
label->setFontSize(_px(40));
label->setText("Agenda");
label->setFontName("fonts/arial.ttf");
sView->addSubview(label);
if (m_msg.empty())
{
requestMsg();
}
else
{
this->initMsgTableView();
}
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);
}
//.........这里部分代码省略.........
示例3: viewDidLoad
void PageMenu::viewDidLoad()
{
g_pCurrentPageMenu = this;
PageBase::viewDidLoad();
CAImageView *pBk = CAImageView::createWithImage(CAImage::create("Bk.png"));
pBk->setFrame( getView()->getFrame() );
getView()->addSubview( pBk );
m_pMenuList = new CATableView();
m_pMenuList->initWithFrame( CCRect( 0 , 0 , getView()->getFrame().size.width , getView()->getFrame().size.height - 120 ) );
m_pMenuList->setTableViewDataSource(this);
m_pMenuList->setTableViewDelegate(this);
m_pMenuList->setTablePullViewHeight( 96 );
//m_pMenuList->setTablePullDownView( CAView::createWithColor( ccc4( 34 , 168 , 109 , 255 ) ) );
m_pMenuList->setTablePullUpView( CAImageView::createWithImage(CAImage::create("MenuDropList.png") ) );
m_pMenuList->setTablePullDownView( CAView::createWithColor( ccc4( 34 , 168 , 109 , 255 ) ) );
getView()->addSubview( m_pMenuList );
m_pMenuList->release();
m_pMenuList->setAllowsSelection( true );
CAImageView *pBk2 = CAImageView::createWithImage(CAImage::create("Bk2.png"));
pBk2->setFrame( CCRect( 0 , getView()->getFrame().size.height - 120 , getView()->getFrame().size.width , 120 ) );
getView()->addSubview( pBk2 );
m_pProgress = CAProgress::create();
m_pProgress->setFrame( CCRect( 0 , -40 , 720 , 44 ) );
//m_pProgress->setProgressTintColor( ccc4( 34 , 168 , 109 , 255 ) );
m_pProgress->setProgressTintColor( ccc4( 255 , 255 , 255 , 255 ) );
m_pProgress->setProgressTintImage( CAImage::create( "DownloadProgress.png" ) );
m_pProgress->setProgresstrackColor( ccc4( 74 , 103 , 92 , 255 ) );
m_pProgress->setVisible( false );
pBk2->addSubview( m_pProgress );
m_pProgressLabel = CALabel::createWithFrame( m_pProgress->getFrame() );
m_pProgressLabel->setColor( ccc4( 255 , 255 , 255 , 255 ) );
m_pProgressLabel->setFontSize( 28 );
m_pProgressLabel->setTextAlignment( CATextAlignmentCenter );
m_pProgressLabel->setVerticalTextAlignmet( CAVerticalTextAlignmentCenter );
pBk2->addSubview( m_pProgressLabel );
// 下载全书
{
CAButton *pButton = CAButton::createWithFrame( CCRect( 64 , 22 , 260 , 88 ) , CAButtonTypeCustom );
pButton->setBackGroundViewForState( CAControlStateNormal , CAScale9ImageView::createWithImage( CAImage::create( "ButtonNormal.png" ) ) );
pButton->setBackGroundViewForState( CAControlStateHighlighted , CAScale9ImageView::createWithImage( CAImage::create( "ButtonLight.png" ) ) );
pButton->setBackGroundViewForState( CAControlStateDisabled , CAScale9ImageView::createWithImage( CAImage::create( "ButtonDisable.png" ) ) );
CALabel *pLabel = CALabel::createWithFrame( CCRect( 0 , 0 , pButton->getFrame().size.width , pButton->getFrame().size.height ) );
pLabel->setText( ("下载全书") );
pLabel->setColor( ccc4( 255 , 255 , 255 , 255 ) );
pLabel->setFontSize( 28 );
pLabel->setTextAlignment( CATextAlignmentCenter );
pLabel->setVerticalTextAlignmet( CAVerticalTextAlignmentCenter );
pButton->addSubview( pLabel );
pBk2->addSubview( pButton );
pButton->addTarget( this , CAControl_selector(PageMenu::OnDownloadAllButtonDown) , CAControlTouchUpInSide );
}
// 章节下载
{
CAButton *pButton = CAButton::createWithFrame( CCRect( 400 , 22 , 260 , 88 ) , CAButtonTypeCustom );
pButton->setBackGroundViewForState( CAControlStateNormal , CAScale9ImageView::createWithImage( CAImage::create( "ButtonNormal.png" ) ) );
pButton->setBackGroundViewForState( CAControlStateHighlighted , CAScale9ImageView::createWithImage( CAImage::create( "ButtonLight.png" ) ) );
pButton->setBackGroundViewForState( CAControlStateDisabled , CAScale9ImageView::createWithImage( CAImage::create( "ButtonDisable.png" ) ) );
CALabel *pLabel = CALabel::createWithFrame( CCRect( 0 , 0 , pButton->getFrame().size.width , pButton->getFrame().size.height ) );
pLabel->setText( ("下载后续章节") );
pLabel->setColor( ccc4( 255 , 255 , 255 , 255 ) );
pLabel->setFontSize( 28 );
pLabel->setTextAlignment( CATextAlignmentCenter );
pLabel->setVerticalTextAlignmet( CAVerticalTextAlignmentCenter );
pButton->addSubview( pLabel );
pBk2->addSubview( pButton );
pButton->addTarget( this , CAControl_selector(PageMenu::OnDownloadButtonDown) , CAControlTouchUpInSide );
}
ShowWait( true );
BookDB::Instance()->GetBookMenu( &m_bookData , this , BookDB_selector(PageMenu::OnComplete) );
}