Hi guys, I tried doing this a while back too but found that using NSNotifications will not work in conjunction with the orientation lock in iPad.
What I did was create a rootViewController (sublass of UIViewController) then attach the cocos2d CCDirector to that rootViewController's view instead of to the application's window view. From there, in the rootViewController I used the usual shouldAutorotateToInterfaceOrientation and willRotateToInterfaceOrientation callbacks to detach and re-attach the CCDirector in a new frame. Here's my rootViewController code:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[[CCDirector sharedDirector] detach];
if(toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
self.view.frame = CGRectMake(0.0f, 0.0f, 768.0f, 1024.0f);
} else if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
self.view.frame = CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f);
}
[[CCDirector sharedDirector] attachInView:self.view withFrame:self.view.frame];
[self.mainScene viewRotated: toInterfaceOrientation]; // tell the main scene the interface orientation changed
}
Hope that helps, it seemed to work pretty well for me.