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類