本文整理汇总了C++中CAView::setFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ CAView::setFrame方法的具体用法?C++ CAView::setFrame怎么用?C++ CAView::setFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAView
的用法示例。
在下文中一共展示了CAView::setFrame方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layoutNewContainer
void CANavigationController::layoutNewContainer()
{
CCRect navigation_bar_rect = CCRectZero;
navigation_bar_rect.size = m_tNavigationBarSize;
CCRect container_rect = this->getView()->getBounds();
if (m_bNavigationBarHidden)
{
navigation_bar_rect.origin = this->getNavigationBarTakeBackPoint();
}
else
{
container_rect.size.height -= m_tNavigationBarSize.height;
navigation_bar_rect.origin = this->getNavigationBarOpenPoint();
if (m_eNavigationBarVerticalAlignment == CABarVerticalAlignmentTop)
{
container_rect.origin.y = m_tNavigationBarSize.height;
}
}
CAView* container = m_pContainers.back();
container->setFrame(this->getView()->getBounds());
CANavigationBar* navigationBar = m_pNavigationBars.back();
navigationBar->setFrame(navigation_bar_rect);
CAView* secondContainer = m_pSecondContainers.back();
secondContainer->setFrame(container_rect);
CAViewController* viewController = m_pViewControllers.back();
viewController->addViewFromSuperview(secondContainer);
viewController->viewDidAppear();
}
示例2: presentModalViewController
void CAWindow::presentModalViewController(CAViewController* controller, bool animated)
{
CC_RETURN_IF(controller == NULL);
CC_RETURN_IF(m_pModalViewController);
CC_SAFE_RETAIN(controller);
m_pModalViewController = controller;
m_pModalViewController->addViewFromSuperview(this);
m_pModalViewController->getView()->setZOrder(CAWindowZOderCenter);
m_pModalViewController->viewDidAppear();
CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsFalse();
if (animated)
{
CAView* view = m_pModalViewController->getView();
DRect frame = view->getFrame();
frame.origin.y = frame.size.height;
view->setFrame(frame);
DRect endFrame = DRectZero;
endFrame.size = view->getFrame().size;
CAViewAnimation::beginAnimations("", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.1f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveLinear);
CAViewAnimation::setAnimationDidStopSelector(this, CAViewAnimation0_selector(CAWindow::presentEnd));
view->setFrame(endFrame);
CAViewAnimation::commitAnimations();
}
else
{
this->presentEnd();
}
}
示例3: ccTouchMoved
void CANavigationController::ccTouchMoved(CATouch *pTouch, CAEvent *pEvent)
{
CC_RETURN_IF(m_pViewControllers.size() <= 1);
CC_RETURN_IF(m_bTouchMoved == false);
float offDis = pTouch->getLocation().x - pTouch->getPreviousLocation().x;
CAView* showContainer = m_pContainers.at(m_pContainers.size() - 2);
if (!showContainer->getBounds().size.equals(this->getView()->getBounds().size))
{
showContainer->setFrame(this->getView()->getBounds());
}
showContainer->setVisible(true);
showContainer->setTouchEnabled(false);
CAView* backContainer = m_pContainers.back();
DPoint point1 = backContainer->getFrameOrigin();
point1.x += offDis;
point1.x = MAX(point1.x, 0);
point1.x = MIN(point1.x, this->getView()->getBounds().size.width);
backContainer->setFrameOrigin(point1);
backContainer->setTouchEnabled(false);
DPoint point2 = showContainer->getCenterOrigin();
point2.x = point1.x/2;
showContainer->setCenterOrigin(point2);
m_bPopViewController = ((offDis > 10) || point1.x > this->getView()->getBounds().size.width/4);
}
示例4: presentModalViewController
void CAWindow::presentModalViewController(CAViewController* controller, bool animated)
{
CC_RETURN_IF(controller == NULL);
CC_RETURN_IF(m_pModalViewController);
CC_SAFE_RETAIN(controller);
m_pModalViewController = controller;
m_pModalViewController->addViewFromSuperview(this);
m_pModalViewController->getView()->setZOrder(CAWindowZoderCenter);
if (animated)
{
CAView* view = m_pModalViewController->getView();
CCRect frame = view->getFrame();
frame.origin.y = frame.size.height;
view->setFrame(frame);
CCRect endFrame = CCRectZero;
endFrame.size = view->getFrame().size;
CCCallFunc* start = CCCallFunc::create(this, callfunc_selector(CAWindow::presentStart));
CCCallFunc* end = CCCallFunc::create(this, callfunc_selector(CAWindow::presentEnd));
CCDelayTime* delayTime = CCDelayTime::create(0.1f);
CCFrameTo* frameTo = CCFrameTo::create(0.3f, endFrame);
CCEaseSineOut* easeBack = CCEaseSineOut::create(frameTo);
CCSequence* allActions = CCSequence::create(start, delayTime, easeBack, end, NULL);
view->runAction(allActions);
}
}
示例5: dismissModalViewController
void CAWindow::dismissModalViewController(bool animated)
{
CC_RETURN_IF(m_pModalViewController == NULL);
if (m_pRootViewController)
{
m_pRootViewController->viewDidAppear();
}
CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsFalse();
if (animated)
{
CAView* view = m_pModalViewController->getView();
DRect endFrame = view->getFrame();
endFrame.origin.y = endFrame.size.height;
CAViewAnimation::beginAnimations("", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.1f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveLinear);
CAViewAnimation::setAnimationDidStopSelector(this, CAViewAnimation0_selector(CAWindow::dismissEnd));
view->setFrame(endFrame);
CAViewAnimation::commitAnimations();
}
else
{
this->dismissEnd();
}
}
示例6: update
void CANavigationController::update(float dt)
{
CCRect rect = this->getView()->getBounds();
CCPoint point = this->getNavigationBarNowPoint();
switch (m_eNavigationBarVerticalAlignment)
{
case CABarVerticalAlignmentTop:
{
rect.origin.y = point.y + m_tNavigationBarSize.height;
rect.size.height = rect.size.height - rect.origin.y;
}
break;
case CABarVerticalAlignmentBottom:
{
rect.size.height = point.y;
}
break;
default:
break;
}
m_pNavigationBars.back()->setFrameOrigin(point);
CAView* secondContainer = m_pSecondContainers.back();
CAViewController* viewController = m_pViewControllers.back();
secondContainer->setFrame(rect);
viewController->getSuperViewRect(secondContainer->getBounds());
}
示例7: viewDidLoad
void FSNewsAboutController::viewDidLoad()
{
winSize = this->getView()->getBounds().size;
if (p_TableView!=NULL)
{
this->getView()->removeSubview(p_TableView);
p_TableView = NULL;
}
p_TableView= CATableView::createWithFrame(CADipRect(0, -150, winSize.width, winSize.height+150));
p_TableView->setTableViewDataSource(this);
p_TableView->setTableViewDelegate(this);
p_TableView->setAllowsSelection(true);
p_TableView->setAllowsMultipleSelection(false);
p_TableView->setAlwaysTopSectionHeader(false);
this->getView()->addSubview(p_TableView);
p_TableView->setTableHeaderHeight(_px(602));
CAView* view = CAView::createWithColor(CAColor_clear);
view->setFrame(CADipRect(0,0,winSize.width,602));
CAImageView* head_bg = CAImageView::createWithFrame(CADipRect(0,0,winSize.width,602));
head_bg->setImage(CAImage::create("image/about_head_bg.png"));
view->addSubview(head_bg);
// CAImageView* head = CAImageView::createWithCenter(CADipRect(winSize.width/2,320,96,96));
// head->setImage(CAImage::create("image/avatar_bg_70.png"));
// view->addSubview(head);
p_TableView->setTableHeaderView(view);
}
示例8: popToRootViewControllerAnimated
// [email protected]3.com: 2015-03-08
void CANavigationController::popToRootViewControllerAnimated(bool animated)
{
if (m_pViewControllers.size() == 1)
{
return ;
}
float x = this->getView()->getBounds().size.width;
CAView* backContainer = m_pContainers.back();
backContainer->setFrameOrigin(DPointZero);
size_t index = 0;
CAViewController* showViewController = m_pViewControllers.at(index);
showViewController->viewDidAppear();
CAView* showContainer = m_pContainers.at(index);
showContainer->setVisible(true);
showContainer->setFrameOrigin(DPoint(-x/2.0f, 0));
{
DPoint point = this->getNavigationBarNowPoint(showViewController);
DRect rect = this->getView()->getBounds();
rect.origin.y = point.y + m_tNavigationBarSize.height;
rect.size.height = rect.size.height - rect.origin.y;
m_pNavigationBars.at(index)->setFrameOrigin(point);
CAView* secondContainer = m_pSecondContainers.at(index);
secondContainer->setFrame(rect);
showViewController->getSuperViewRect(secondContainer->getBounds());
}
CAApplication::getApplication()->getTouchDispatcher()->setDispatchEventsFalse();
if (animated)
{
CAViewAnimation::beginAnimations("", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.02f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
showContainer->setFrameOrigin(DPointZero);
CAViewAnimation::commitAnimations();
CAViewAnimation::beginAnimations("", NULL);
CAViewAnimation::setAnimationDuration(0.25f);
CAViewAnimation::setAnimationDelay(0.03f);
CAViewAnimation::setAnimationCurve(CAViewAnimationCurveEaseOut);
CAViewAnimation::setAnimationDidStopSelector(this, CAViewAnimation0_selector(CANavigationController::popToRootViewControllerFinish));
backContainer->setFrameOrigin(DPoint(x, 0));
CAViewAnimation::commitAnimations();
}
else
{
this->popToRootViewControllerFinish();
}
}
示例9: initNewsPageView
void CDNewsViewController::initNewsPageView()
{
//初始化pageView
CAView* tempview = CAView::create();
p_PageView = CAPageView::createWithFrame(DRect(0,0,winSize.width,winSize.width/2), CAPageViewDirectionHorizontal);
p_PageView->setPageViewDelegate(this);
p_PageView->setTouchEnabled(true);
CAVector<CAView* > viewList;
CommonUrlImageView* temImage0 = CommonUrlImageView::createWithFrame(DRect(winSize.width/2,100,winSize.width,winSize.width/2));
temImage0->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
temImage0->setImage(CAImage::create("image/HelloWorld.png"));
temImage0->setUrl(m_page[m_page.size()-1].m_pic);
viewList.pushBack(temImage0);
for (int i=0; i<m_page.size(); i++) {
//初始化viewList
CommonUrlImageView* temImage = CommonUrlImageView::createWithFrame(DRect(winSize.width/2,100,winSize.width,winSize.width/2));
temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
temImage->setImage(CAImage::create("image/HelloWorld.png"));
temImage->setUrl(m_page[i].m_pic);
viewList.pushBack(temImage);
}
CommonUrlImageView* temImage1 = CommonUrlImageView::createWithFrame(DRect(winSize.width/2,100,winSize.width,winSize.width/2));
temImage1->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
temImage1->setImage(CAImage::create("image/HelloWorld.png"));
temImage1->setUrl(m_page[0].m_pic);
viewList.pushBack(temImage1);
p_PageView->setViews(viewList);
tempview->addSubview(p_PageView);
p_PageView->setCurrPage(1, false);
pageControl = CAPageControl::createWithCenter(DRect(winSize.width-80, winSize.width/2-25, 100, 50));
pageControl->setNumberOfPages((int)m_page.size());
pageControl->setPageIndicatorImage(CAImage::create("image/pagecontrol_selected.png"));
pageControl->setCurrIndicatorImage(CAImage::create("image/pagecontrol_bg.png"));
pageControl->setPageIndicatorTintColor(CAColor_gray);
//pageControl->setCurrentPageIndicatorTintColor(CAColor_clear);
pageControl->addTarget(this, CAControl_selector(CDNewsViewController::pageControlCallBack));
tempview->addSubview(pageControl);
CAView* bg = CAView::createWithColor(ccc4(0, 0, 0, 128));
bg->setFrame(DRect(0,winSize.width/2-50,winSize.width,50));
tempview->addSubview(bg);
if (m_page.size()>0) {
pageViewTitle = CALabel::createWithFrame(DRect(10, winSize.width/2-40, winSize.width-50, 50));
pageViewTitle->setText(m_page[0].m_title);
pageViewTitle->setColor(CAColor_white);
pageViewTitle->setFontSize(_px(28));
tempview->addSubview(pageViewTitle);
}
p_TableView->setTableHeaderView(tempview);
p_TableView->setTableHeaderHeight(_px(winSize.width/2));
}
示例10: showTextViewMark
void CATextSelViewEx::showTextViewMark(const std::vector<CCRect>& vt)
{
hideTextViewMark();
for (int i = 0; i < vt.size(); i++)
{
CAView* pTextMaskView = CAView::createWithColor(ccc4(60, 120, 240, 127));
pTextMaskView->setFrame(vt[i]);
addSubview(pTextMaskView);
m_pTextViewMask.push_back(pTextMaskView);
}
this->setVisible(true);
}
示例11: loadCell
void CAListView::loadCell()
{
DRect rect = this->getBounds();
rect.origin = getContentOffset();
rect.origin.y -= rect.size.height * 0.1f;
rect.origin.x -= rect.size.width * 0.1f;
rect.size.width *= 1.2f;
rect.size.height *= 1.2f;
std::map<unsigned int, CAListViewCell*>::iterator itr;
for (itr = m_mpUsedListCells.begin(); itr != m_mpUsedListCells.end(); itr++)
{
CC_CONTINUE_IF(itr->second != NULL);
unsigned int index = itr->first;
DRect cellRect = m_rIndexRects[index];
CC_CONTINUE_IF(!rect.intersectsRect(cellRect));
CAListViewCell* cell = m_pListViewDataSource->listViewCellAtIndex(this, cellRect.size, index);
if (cell)
{
cell->m_nIndex = index;
cell->updateDisplayedAlpha(this->getAlpha());
addSubview(cell);
cell->setFrame(cellRect);
m_mpUsedListCells[index] = cell;
m_vpUsedListCells.pushBack(cell);
}
if (m_pSelectedListCells.count(index))
{
cell->setControlState(CAControlStateSelected);
}
if (m_pListViewDataSource)
{
m_pListViewDataSource->listViewWillDisplayCellAtIndex(this, cell, index);
}
CAView* view = this->dequeueReusableLine();
DRect lineRect = m_rLineRects[index];
if (view == NULL)
{
view = CAView::createWithFrame(lineRect, m_obSeparatorColor);
}
m_pUsedLines[index] = view;
this->insertSubview(view, 1);
view->setFrame(lineRect);
}
}
示例12: layoutNewContainer
void CANavigationController::layoutNewContainer()
{
CAViewController* viewController = m_pViewControllers.back();
DRect navigation_bar_rect = DRectZero;
navigation_bar_rect.size = m_tNavigationBarSize;
DRect container_rect = this->getView()->getBounds();
if (m_bNavigationBarHidden || viewController->getNavigationBarItem()->isNagigationBarHidden())
{
navigation_bar_rect.origin = this->getNavigationBarTakeBackPoint();
}
else
{
container_rect.size.height -= m_tNavigationBarSize.height;
navigation_bar_rect.origin = this->getNavigationBarOpenPoint();
container_rect.origin.y = m_tNavigationBarSize.height;
}
CAView* container = m_pContainers.back();
container->setFrame(this->getView()->getBounds());
CANavigationBar* navigationBar = m_pNavigationBars.back();
navigationBar->setFrame(navigation_bar_rect);
CAView* secondContainer = m_pSecondContainers.back();
secondContainer->setFrame(container_rect);
viewController->addViewFromSuperview(secondContainer);
if (m_pViewControllers.size() > 1)
{
viewController->viewDidAppear();
}
}
示例13: update
void CANavigationController::update(float dt)
{
CAViewController* viewController = m_pViewControllers.back();
DPoint point = this->getNavigationBarNowPoint(viewController);
DRect rect = this->getView()->getBounds();
rect.origin.y = point.y + m_tNavigationBarSize.height;
rect.size.height = rect.size.height - rect.origin.y;
m_pNavigationBars.back()->setFrameOrigin(point);
CAView* secondContainer = m_pSecondContainers.back();
secondContainer->setFrame(rect);
viewController->getSuperViewRect(secondContainer->getBounds());
}
示例14: createWithContainer
void CANavigationController::createWithContainer(CAViewController* viewController)
{
CAView* container = new CAView();
container->setFrame(this->getView()->getBounds());
this->getView()->addSubview(container);
m_pContainers.pushBack(container);
container->release();
CANavigationBar* navigationBar = CANavigationBar::create(DSize(this->getView()->getBounds().size.width, 0));
if (viewController->getNavigationBarItem() == NULL && viewController->getTitle().compare("") != 0)
{
viewController->setNavigationBarItem(CANavigationBarItem::create(viewController->getTitle()));
}
if (m_pViewControllers.empty())
{
viewController->getNavigationBarItem()->setShowGoBackButton(false);
}
navigationBar->setItem(viewController->getNavigationBarItem());
if (m_pNavigationBarBackgroundImage)
{
navigationBar->setBackgroundView(CAScale9ImageView::createWithImage(m_pNavigationBarBackgroundImage));
}
else
{
navigationBar->setBackgroundView(CAView::create());
}
navigationBar->getBackgroundView()->setColor(m_sNavigationBarBackgroundColor);
navigationBar->setTitleColor(m_sNavigationBarTitleColor);
navigationBar->setTitleColor(m_sNavigationBarTitleColor);
container->insertSubview(navigationBar, 1);
navigationBar->setDelegate(this);
m_pNavigationBars.pushBack(navigationBar);
CAView* secondContainer = new CAView();
container->addSubview(secondContainer);
secondContainer->release();
m_pSecondContainers.pushBack(secondContainer);
viewController->m_pNavigationController = this;
m_pViewControllers.pushBack(viewController);
}
示例15: ShowTextViewMask
void ShowTextViewMask()
{
HideTextViewMask();
int iFlagTrick = -1;
std::vector<DRect> vt = getZZCRect();
for (int i = 0; i < vt.size(); i++)
{
CAView* pTextMaskView = CAView::createWithColor(ccc4(60, 120, 240, 127));
if (vt[i].origin.y == iFlagTrick)
{
vt[i].InflateRect(0, -1, 0, -1);
}
iFlagTrick = vt[i].origin.y + vt[i].size.height;
pTextMaskView->setFrame(vt[i]);
m_pContainerView->addSubview(pTextMaskView);
m_vTextViewMask.push_back(pTextMaskView);
}
}