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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:28:30+00:00 2026-06-07T16:28:30+00:00

I have a UITabBarController that contains two view controllers. One is the default view

  • 0

I have a UITabBarController that contains two view controllers. One is the default view controller created when Xcode creates a new “Tabbed Application”. The other, I call my cocos2d view controller, is a UIViewController which contains a single CCGLView, which occupies the whole nib. It has a single CCScene and a single CCLayer within that scene and a single CCSprite within that CCLayer, which moves back and forth across the layer forever.

I run the program with the cocos2d view controller being displayed first and the sprite moving happily. When I select the second tab and come back, the sprite is no longer moving. Tabbing back and forth more doesn’t make it move again. I set a breakpoint inside didSelectViewController and examined the sharedDirector. It is not paused, it has a framerate and everything.

I also have a separate tabbed app that implements ccTouchesBegan and moves the layer around according to the users gestures. In that app, the touches are still detected, the position of the layer is changed, but the view on the device/simulater never changes. Even if I change the position, tab away and back, the original non moved image is shown.

Question: Why does the cocos2d view apparently stop it’s render loop?

Here’s what I’ve got in the cocos2d view controller of my test app:

- (void)viewDidLoad
{
    [super viewDidLoad];
    director = [CCDirector sharedDirector];
    [director setDisplayStats:YES];

    [self runCocos2d];
}

- (void) runCocos2d
{
    glView.multipleTouchEnabled = YES;
    [[CCDirector sharedDirector] setView:self.glView];

    scene = [TestScene node];
    [[CCDirector sharedDirector] pushScene:scene];
    [scene startScene];
}

StartScene just calls this method in my layer

- (void) start
{
    CGSize winSize = [CCDirector sharedDirector].winSize;

    CCSprite *seeker = [CCSprite spriteWithFile:@"seeker.png"];
    seeker.position = ccp(0, winSize.height/2);

    [self addChild: seeker z:0];

    // move the table constantly so we can see if anything it rendering
    id moveToPosition1 = [CCMoveTo actionWithDuration: 3
                                         position: ccp(winSize.width, winSize.height/2)];
    id moveToPosition2 = [CCMoveTo actionWithDuration: 3
                                         position: ccp(0, winSize.height/2)];
    id sequence = [CCSequence actions:moveToPosition1, moveToPosition2, nil];

    id moveOverAndOver = [CCRepeatForever actionWithAction:sequence];

    [seeker runAction: moveOverAndOver];
}
  • 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-07T16:28:31+00:00Added an answer on June 7, 2026 at 4:28 pm

    I fumbled around with calling different methods on the shared director and found that calling startAnimation when the cocos2d view controller was selected, would make it all work correctly. I Googled for a good while and didn’t come up with that, so hopefully this’ll save someone some time.

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

Sidebar

Related Questions

I have an app with a custom UITabBarController that contains five view controllers. Within
I have a UITabBarController where the default view controller is a UINavigationController . I
I have a UITabBarController that manages 5 View Controllers. I create their tab bar
I have a UITabBarController that is loading a UINavigationController. When I push a new
Ok so basically I have a UITabBarController as my root view controller. I have
I have a class that is a subclass of UITabBarController which contains 4 child
I have an app which uses a UITabBarController which contains 4 different navigation controllers.
I have an application that has a UITabBarController with two tabs, each having its
I have a UITabBarController that has 3 tabs. Each tab contains a UITableViewController. When
I have a UITabBarController created programaticaly that manages 4 subclasses of UIViewController. Something like:

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.