请各位大神解释一下,我想在窗口建一个可以点击变色的小方块,可为什么每次点击小方块变色后程序就停止出现错误了,感激不尽啊,
以下是代码:
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super's" return value
if( (self=super init]) ){
CGSize size=CCDirector sharedDirector] winSize];
CCSprite*turnleftsprite=CCSprite spriteWithFile:@"turnleft.png"];
CCSprite*turnleftsprite2=CCSprite spriteWithFile:@"turnleft.png"];
turnleftsprite2.color=ccBLUE;
CCMenuItemSprite*item2=
CCMenuItemSprite itemFromNormalSprite:turnleftsprite selectedSprite:turnleftsprite2 target:self selector:@selector(menu: item2Touched: )];
CCMenu*menu=CCMenu menuWithItems:item2, nil];
menu.position=CGPointMake(size.width/2,size.height/2);
self addChild:menu];
}
return self;
}
cocos2d: cocos2d-iphone v2.1-rc0a
cocos2d: compiled with Profiling Support: NO
cocos2d: OS version: 6.1 (0x06010000)
cocos2d: GL_VENDOR: Apple Computer, Inc.
cocos2d: GL_RENDERER: Apple Software Renderer
cocos2d: GL_VERSION: OpenGL ES 2.0 APPLE
cocos2d: GL_MAX_TEXTURE_SIZE: 4096
cocos2d: GL_MAX_TEXTURE_UNITS: 8
cocos2d: GL_MAX_SAMPLES: 4
cocos2d: GL supports PVRTC: YES
cocos2d: GL supports BGRA8888 textures: YES
cocos2d: GL supports NPOT textures: YES
cocos2d: GL supports discard_framebuffer: YES
cocos2d: GL supports shareable VAO: NO
2013-03-20 21:29:24.843 anjian Retina Display Not supported
2013-03-20 21:29:24.849 anjian cocos2d: animation started with frame interval: 60.00
2013-03-20 21:29:24.851 anjian cocos2d: surface size: 480x320
2013-03-20 21:29:24.854 anjian cocos2d: CCTexture2D: Using RGB565 texture since image has no alpha
2013-03-20 21:29:27.034 anjian -: unrecognized selector sent to instance 0x93382c0
2013-03-20 21:29:27.036 anjian *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-: unrecognized selector sent to instance 0x93382c0'
*** First throw call stack:
(0x2507012 0x1ee4e7e 0x25924bd 0x24f6bbc 0x24f694e 0x1ef86b0 0x54ac5 0x524bc 0x4fc49 0x1ef8705 0xba8cf 0xbb463 0xb846e 0xae6cef 0xae6f02 0xac4d4a 0xab6698 0x320fdf9 0x320fad0 0x247cbf5 0x247c962 0x24adbb6 0x24acf44 0x24ace1b 0x320e7e3 0x320e668 0xab3ffc 0xdcd76 0x23c5)
libc++abi.dylib: terminate called throwing an exception
(lldb)