CCNodeColor继承自CCNode,因此能被CCScene 作为子节点加入。
API上解释:CCNodeColor is a subclass of CCNode that is used to generate solid colors.即用来生成实体颜色。
两个类方法:+ (id)nodeWithColor:(CCColor *)color width:(GLfloat)w height:(GLfloat)h//在生成颜色同时指定宽和高
+ (id)nodeWithColor:(CCColor *)color //生成指定颜色,宽和高是window的宽和高
两个实例方法 - (id)initWithColor:(CCColor *)color width:(GLfloat)w height:(GLfloat)h
- (id)initWithColor:(CCColor *)color 功能和类方法一致
一个属性:blendFunc,这个属性是只读的。@property (nonatomic, readwrite) ccBlendFunc blendFunc
CCNodeColor使用举例
CCNodeColor *background = [CCNodeColor nodeWithColor:[CCColor colorWithRed:0.7f green:0.7f blue:0.2f alpha:1.0f]];
[self addChild:background];//self 是一个CCScene类