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

  • SEARCH
  • Home
  • 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 7885435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:04:12+00:00 2026-06-03T05:04:12+00:00

So I want my main menu to have a ccMenu. I tried exploring with

  • 0

So I want my main menu to have a ccMenu. I tried exploring with align vertically and alignItemsInColumns but all these options center the items within the menu. If I wanted something that looked like this:

Title

 Option 1 has a very long name
 Option 2 is short
 Shorter

instead of this:

Title

Option 1 has a very long name
     Option 2 is short
          Shorter

How could I achieve this in cocos2d? Thanks for the help.

EDIT:

I tried using this code but I got this result:

CCLabelTTF * sin = [CCLabelTTF labelWithString:@"Single Player" dimensions:CGSizeMake(120,    25) alignment:UITextAlignmentLeft fontName:font fontSize:20];
CCMenuItem * item1 = [CCMenuItemLabel itemWithLabel:sin target:self selector:@selector(goToSinglePlayer:)];

CCLabelTTF * spl = [CCLabelTTF labelWithString:@"Splitscreen" dimensions:CGSizeMake(100, 25) alignment:UITextAlignmentLeft fontName:font fontSize:20];
CCMenuItem * item2 = [CCMenuItemLabel itemWithLabel:spl target:self selector:@selector(goToSplitscreen:)];

CCLabelTTF * ach = [CCLabelTTF labelWithString:@"Achievements" dimensions:CGSizeMake(130, 25) alignment:UITextAlignmentLeft fontName:font fontSize:20];
CCMenuItem * item3 = [CCMenuItemLabel itemWithLabel:ach target:self selector:@selector(goToAchievements:)];

CCLabelTTF * str = [CCLabelTTF labelWithString:@"Store" dimensions:CGSizeMake(50, 25) alignment:UITextAlignmentLeft fontName:font fontSize:20];
CCMenuItem * item4 = [CCMenuItemLabel itemWithLabel:str target:self selector:@selector(goToStore:)];

CCLabelTTF * set = [CCLabelTTF labelWithString:@"Settings" dimensions:CGSizeMake(80, 25) alignment:UITextAlignmentLeft fontName:font fontSize:20];
CCMenuItem * item5 = [CCMenuItemLabel itemWithLabel:set target:self selector:@selector(goToSettings:)];

CCMenu * mainMenu = [CCMenu menuWithItems:item1, item2, item3, item4, item5, nil];

[mainMenu setColor:ccBLACK];
[mainMenu alignItemsVerticallyWithPadding:10];
mainMenu.position =  ccp(size.width/6, size.height/2);
[self addChild:mainMenu];

Game Screen

Seems like it didn’t do anything. What’s wrong with the code?

  • 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-06-03T05:04:14+00:00Added an answer on June 3, 2026 at 5:04 am

    Make a menu with CCMenuItemLabel items. Create each label with CCLabelTTF, giving it left alignment and known dimensions. When you add the menuItems to the menu, they will align if all have the same dimensions.

    added :

     CGSize label = CGSizeMake(160., 45.); 
     CCLabelTTF *label1 = [CCLabelTTF labelWithString:@"Option1 for example" 
                                           dimensions:size 
                                            alignment:UITextAlignmentLeft
                                             fontName:@"pickYourOwnFont" fontSize:16.];
    
     CCLabelTTF *label2 = [CCLabelTTF labelWithString:@"Option2 below option 1" 
                                           dimensions:size 
                                            alignment:UITextAlignmentLeft 
                                             fontName:@"pickYourOwnFont" fontSize:16.];
    CCMenuItem * item1 = [CCMenuItemLabel itemWithLabel:label1];
    CCMenuItem * item2 = [CCMenuItemLabel itemWithLabel:label2];
    CCMenu * leftAlignedMenu=[CCMenu menuWithItems:item1,item2,nil];
    

    you can set whatever properties you like to the labels (color, etc…) and the menuItem’s (callback target and selector).

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

Sidebar

Related Questions

I have a log out button on my main menu and I want it
I did hidden eclipse main menu. I want to display all item of eclipse
I have a UserControl which I want to have 3 possible states: -Main menu
I want to add submenu into the main menu in runtime. I have looked
I have and app and on my main menu page I want to load
So I have a menu that I want to generate a main menu based
I want to create a multilevel menu using jQuery. The main idea is by
I'm trying to do blog application and I want main page to have this
I have two viewstacks one for Main menu and another one for submenu. I
In my app I want to create a main menu screen layout. The layout

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.