主要参照
http://blog.csdn.net/bill_man/article/details/7220699
但是部分函数新版的需要改一下
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor*layer=CCLayerColor::create(ccc4(0xFF, 0x00, 0x00, 0x80),200,200);
//新版中,用create新建新图层,建立的新图层只有一个颜色
layer->ignoreAnchorPointForPosition(false);
layer->setPosition(ccp(s.width/2, s.height/2) );
this->addChild(layer, 1);
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerGradient*layer=CCLayerGradient::create(ccc4(0xFF, 0x00, 0x00, 0x80),ccc4(255, 255, 0, 80));
//新建图层为两个颜色渐变效果图
layer->ignoreAnchorPointForPosition(false);
layer->setPosition(ccp(s.width/2, s.height/2) );
this->addChild(layer, 1);