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 8338297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:33:05+00:00 2026-06-09T04:33:05+00:00

I am currently trying to permanently show up a TextField on a cocos2d v2

  • 0

I am currently trying to permanently show up a TextField on a cocos2d v2 layer.

I am using this CCTextField because it looks easy to use : https://github.com/iNinja/CCTextField

The plugin is kind of old for cocos2d v2 so I updated the deprecated methods, but I still cannot show up any text field …

How am I suppose to show a Text Field with cocos2d v2 (any means will do as long as it is clear enough and easy to use).

By the way, I looked on Google and came accross 2-3 answers on stackoverflow and forums. However, they are for cocos2d v1 (or earlier) and do not work at all (or are not clear enough).

EDIT

This is what I have in the onEnter function of my class

 UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(200, 200, 150, 50)];
tf.delegate = self;
tf.textAlignment = UITextAlignmentLeft;

[[[CCDirector sharedDirector] view] addSubview:tf];

And this is the .h

@interface AdventureLayer : CCLayer <UITextFieldDelegate>

Nothing shows up anywhere …

EDIT 2

Hahaha ! Actually the TextField is INVISIBLE ! A placeholder is therefore very usefull

 tf.placeholder = @"FOOBAR";
  • 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-09T04:33:07+00:00Added an answer on June 9, 2026 at 4:33 am

    Cocos2d 2.0 makes it very easy to add UIKit elements as CCDirector is actually a UIViewController.

    Create a UITextField in code and then just do the following

     UITextField *aTextField = ...
     [[CCDirector sharedDirector] view] addSubview:aTextField];
    

    Remember that its coordinate system starts from top left not bottom left like cocos2d.

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

Sidebar

Related Questions

I'm currently trying this: using DocumentFormat.OpenXml.Packaging; using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(fileNameDocx as string, true))
Currently trying to get a Bluteooth sample working. I'm using this sample as reference
I'm currently trying to get the most popular productID from my MSSQL Database. This
im currently trying to make a simple IRC Gui Client. Im using the SmartIrc4net
Currently trying to create an XML system using Ogre and the STL. As a
I'm trying to permanently create a calculated dimension member using a MDX ADOMD command
Currently trying to insert an object into the Customer table using a test SQL
I'm currently trying to add the facebook apps request from our java server using
Currently trying at add ajax to a site, after much reading I discovered that
Im currently trying to downlaod a audio track from a WCF, i need some

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.