Has anyone used the default popup mechanism with cocos2d? I am writing a board game (my first) that doesn't necessarily need my own custom popups--figured that any extra HIG features I have could only help.
After a couple (dozen?) failed attempts, I've been able to generate a popup on helloWorld thanks to the example at http://blog.blackwhale.at/2010/04/show-a-custom-popover-view/
I've been able to use the following as a CCMenu callback:
-(void) actionPerformed:(id)sender {
NSLog(@"called actionPerformed");
//build our custom popover view
UIViewController* popoverContent = [[UIViewController alloc]
init];
UIView* popoverView = [[UIView alloc]
initWithFrame:CGRectMake(0, 0, 200, 300)];
popoverView.backgroundColor = [UIColor greenColor];
popoverContent.view = popoverView;
//resize the popover view shown
//in the current view to the view's size
popoverContent.contentSizeForViewInPopover =
CGSizeMake(200, 300);
//create a popover controller
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
//present the popover view non-modal with a
//refrence to the button pressed within the current view
[popoverController presentPopoverFromRect:CGRectMake(200, 200, 200, 200)
inView:[[CCDirector sharedDirector]openGLView]
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
//release the popover content
[popoverView release];
[popoverContent release];
}
But I have absolutely no luck trying to run a CCLayer inside the UIView while the main window is still the current scene. If all else fails, I may just take the easy way out and build things in interface builder. But my OCD still wants me to get this working.
Can anyone help?