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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:46:26+00:00 2026-05-23T17:46:26+00:00

I wish to restart a view controller. What I’ve done is to pop the

  • 0

I wish to restart a view controller.

What I’ve done is to pop the current view controller off the navigation stack, and push a new instance of the view controller onto the stack.
However, this does not work. The current view controller is popped off the navigation stack but, the new instance is not pushed onto the stack.

Here is my code snippet:

[[self navigationController] popViewControllerAnimated:YES];

VideoPlayerViewController *videoPlayer = [[VideoPlayerViewController alloc] init];
[videoPlayer setMedia:media];

[[self navigationController] pushViewController:videoPlayer animated:YES];
[videoPlayer release];
videoPlayer = nil;

NSLog(@"Restarting view controller...");

Any idea what could be wrong?

  • 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-05-23T17:46:27+00:00Added an answer on May 23, 2026 at 5:46 pm

    Based on your code, it looks like you’re trying to pop the current view controller and then immediately re-push it, with animations in both directions. I can’t imagine why you’d want to do this, but setting that aside for the moment, here’s how you can make it work.

    First, add <UINavigationControllerDelegate> to your @interface declaration. Then:

    - (void)repushViewController {
        self.navigationController.delegate = self;
        [[self navigationController] popViewControllerAnimated:YES];
    }
    
    - (void)navigationController:(UINavigationController *)navController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
        navController.delegate = nil;
        VideoPlayerViewController *videoPlayer = [[VideoPlayerViewController alloc] init];
        [videoPlayer setMedia:media];
    
        [navController pushViewController:videoPlayer animated:YES];
    
        [videoPlayer release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Wish you all are doing fine at the start of a new year I
I wish to disable the landscape view in an android application . I've used
wish to ajax/refresh the current page after quitting a jquery dialog. I am having
I wish to make the uploaded file contents only viewable on the browser i.e
I wish to do this using only XAML - How to add an additional
I wish fetch data in a XML file, where Tag is a variable.. My
I wish to add the mouseover events to a panel which contains more than
I wish to edit ini files over web server, decided to use django, been
I wish HTML could do something semantically equivalent to this; <dl class=main-list> <definitionitem> <dt>Some
I wish to move backwards - lets say im in Backgrounds node. Then i

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.