Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3879510
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:44:06+00:00 2026-05-19T22:44:06+00:00

Iam trying to create simple menu according to the book CCMenuItem . here is

  • 0

Iam trying to create simple menu according to the book CCMenuItem . here is my MenuView.m code
bot nothing happens just a black screen appears ! without any menu !

iam working with COCOS2D 0.99.5

//
//  MenuView.m
//  Sence


#import "MenuView.h"
#import "HelloWorldScene.h"

@implementation MenuView

// in dastor hatman bayad dar menu badi neveshte shavad ke be onvane ye view shenasande shavad
+(id) scene
{
        CCScene* scene = [CCScene node];
        CCLayer* layer = [MenuView node];
        [scene addChild:layer];
        return scene;
}




-(id) init
{
        if ((self = [super init]))
        {
                CCLOG(@"init %@", self);

                // wait a short moment before creating the menu so we can see it scroll in
                [self schedule:@selector(createMenu:) interval:2];
        }
        return self;
}





- (void) menuItem1Touched {

        NSLog(@"test");
}


- (void) createMenu:(ccTime) delta {

 [self unschedule:_cmd];


        CGSize size = [[CCDirector sharedDirector] winSize];

        // set CCMenuItemFont default properties
        [CCMenuItemFont setFontName:@"Helvetica-BoldOblique"];
        [CCMenuItemFont setFontSize:40];

        // create a few labels with text and selector
        CCMenuItemFont* item1 = [CCMenuItemFont itemFromString:@"Go Back!" target:self selector:@selector(menuItem1Touched:)];


        // create the menu using the items
        CCMenu* menu = [CCMenu menuWithItems:item1, nil];
        menu.position = CGPointMake(-(size.width / 2), size.height / 2);
        menu.tag = 100;
        [self addChild:menu];

        // calling one of the align methods is important, otherwise all labels will occupy the same location
        [menu alignItemsVerticallyWithPadding:40];

}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:44:06+00:00Added an answer on May 19, 2026 at 10:44 pm

    Your this line:

    CCMenuItemFont* item1 = [CCMenuItemFont itemFromString:@"Go Back!" target:self selector:@selector(menuItem1Touched:)];
    

    should be

    CCMenuItemFont* item1 = [CCMenuItemFont itemFromString:@"Go Back!" target:self selector:@selector(menuItem1Touched)];
    

    Change from menuItem1Touched: to menuItem1Touched.. Remove the :

    Tested and works..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a simple menu using li elements, but it only
I am trying to create a simple dialog in MFC using Visual C++. My
I am trying to create a simple page that enters data in to a
I am trying to create a rather simple effect on a set of images.
I am trying to create a horizontal menu with the elements represented by <span>
I am trying to create a simple Python module for MySQL Workbench 5.1.17 SE
I am trying to create a new contact using Dynamic Entity. The sample i
I am trying create a WCF service that leverages the WPF MediaPlayer on the
I am trying to create an XML file based on data fields from a
I am trying to create a subclass of WebPart that will act as a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.