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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:47:25+00:00 2026-06-01T09:47:25+00:00

I have a little app up that has both CCLayer view and UIView. That

  • 0

I have a little app up that has both CCLayer view and UIView. That works fine. I am simply trying to send a message to a reference of the layer so the Cocos2d CCLayer can receive the message. This seems simple and I’d think should work. I created a CCLayer pointer called “cocos” as an iVar and set it as this after creating the cocos view:

[[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];

CCScene*tempscene=[[CCDirector sharedDirector] runningScene];
cocos=[tempscene.children objectAtIndex:0];

As this is a simple little test app with just one scene and layer, it should work. But the iVar cocos doesn’t respond to any of the public methods in HelloWorldLayer. Any idea why?

UPDATE: I got it to work by simply re-arranging the code a bit. Not sure why it worked this way and not the prior way:

  CCScene*tempscene=[HelloWorldLayer scene];
[[CCDirector sharedDirector] runWithScene: tempscene];


cocos=[tempscene.children objectAtIndex:0];
  • 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-01T09:47:27+00:00Added an answer on June 1, 2026 at 9:47 am

    The reason that the first bit of code didn’t work for you is that runWithScene: doesn’t immediately set the runningScene property of CCDirector to [HelloWorldLayer scene].

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

Sidebar

Related Questions

I have a little WPF app, that has a TreeView to display hierarchical data.
I have a little app that have by default youtube as homepage. You can
I have a little iOS5 app that shows images. I click on the image
I have an app that I've written in C#/WinForms ( my little app ).
I have a little one-liner in my Rails app that returns a range of
I have a little logging app (written in wxPython) that receives data from a
I am learning flex and have written a little app with a TextArea that
I have an app that I'm writing a little wizard for. It automated a
I have to develop an app that has to present a floor of hexagons
I have a website that I am working on that has both an intranet

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.