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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:39:53+00:00 2026-06-18T00:39:53+00:00

This question is using cocos2d with xcode , but i think general objective c

  • 0

This question is using cocos2d with xcode, but i think general objective c guys can handle it.

I have a class which is a CCLayer and i want to return it as a layer to my main class and show it in there(and all actions happens in that layer class) .

so the “other” class is :

CCSprite *r;


    -(id)set
    {
        r=[CCSprite spriteWithFile:@"c5.png"];
        r.position=ccp(50,50);
        [self addChild:r z:3];
        return self;


    }

and from main class i call it with :

recieverCircleLayer *r=[recieverCircleLayer alloc] ;
        [self addChild:[r  set ]];

so nothing is happen and i dont see that sprite from the other class on screen.

what am i missing ?
thanks .

  • 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-18T00:39:55+00:00Added an answer on June 18, 2026 at 12:39 am

    Your second code snippet should be:

    recieverCircleLayer *r = [[recieverCircleLayer alloc] init];
    [self addChild:[r  set]];
    

    You forgot the init in alloc-init. Regardless of whether or not that completely solves your problem, it’s definitely a step in the right direction. 😉

    Also, class names should start with an uppercase letter and be camel cased all the way through. For example, RecieverCircleLayer.

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

Sidebar

Related Questions

i'm using cocos2d, however the question is general. i have a class CCNode *scaleLayer
I'm making a game on iPhone using cocos2d, and I have a question. In
I have been learning and using Objective-C and cocos2d (iOS game-engine) for a couple
Basically a dup of this question using php , but I need it for
I would like to ask the same thing than this question but using SWT:
I have asked this question about using the a Linq method that returns one
I want to repeat this question using python. Reason is I have access to
Similar to This Question using linq to SQL , but I don't want to
I'm using Cocos2D for iOS, but you most likely don't have to be familiar
Yesterday I posted this question regarding using lambdas inside of a Join() method to

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.