解释:
bool CCMenu::initWithArray(CCArray* pArrayOfItems)
{
if (CCLayer::init())
{
// menu in the center of the screen
CCSize s = CCDirector::sharedDirector()->getWinSize();
this->ignoreAnchorPointForPosition(true);
setAnchorPoint(ccp(0.5f, 0.5f));
this->setContentSize(s);
setPosition(ccp(s.width/2, s.height/2));
return true;
}
return false;
}
menu忽略锚点(相当于以左下角为锚点),而且初始大小为WinSize,位置在屏幕中间。
所以,我们即使设置锚点,也没有用处。但是可以设置位置和大校
而且不要使用基于menu锚点的坐标计算方法。