Hi, I use the following code to add cocos2d scene to a viewcontroller
- (void)viewDidLoad {
self.view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
if( ! [CCDirector setDirectorType:CCDirectorTypeDisplayLink] )
[CCDirector setDirectorType:CCDirectorTypeDefault];
[[CCDirector sharedDirector] setPixelFormat:kPixelFormatRGBA8888];
[CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];
[[CCDirector sharedDirector] setDeviceOrientation:kCCDeviceOrientationPortrait];
[[CCDirector sharedDirector] setAnimationInterval:1.0/60];
[[CCDirector sharedDirector] attachInView:self.view];
///adding HelloWorld scene to the view...
[[CCDirector sharedDirector] runWithScene: [HelloWorld scene]];
[super viewDidLoad];
}
And now i need to set the alpha value of self.view....so i did it..
-(void)displaySharePage
{
self.view.alpha=0;
}
But it crashed......don't know why....i got the message..
'A Director was alloced. setDirectorType must be the first call to Director'
can anyone help.....advance thanks..