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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:55:49+00:00 2026-05-30T09:55:49+00:00

I have a UIViewCOntroller , and my code is as follows. TviewController *tviewController =

  • 0

I have a UIViewCOntroller, and my code is as follows.

TviewController *tviewController = [[TviewController alloc]init];
    [self.navigationController pushViewController:tviewController animated:YES];

Now from TviewController i go to another viewCOntroller;

XviewController *xviewController = [[XviewController alloc]init];
    [self.navigationController pushViewController:xviewController animated:YES];

in this XviewController there is a button, when i click that button i need to move BACK to the TviewController How do i do this programatically ?

note: I don’t want to use pushViewController and push it further. I need to go back to the TviewController (as in clicking the back button twice)

  • 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-30T09:55:50+00:00Added an answer on May 30, 2026 at 9:55 am

    there is 3 possible ways.

    1. use popToRootViewControllerAnimated: -> to go back root view controller (first view controller)

    2. use popViewControllerAnimated: -> to go backward 1. it’s exact same way as back button.

    3. use popToViewController:animated: -> to go back to UIViewController you want (as long as it’s stack at back).

    point 1 & 2 is pretty easy to implement and other answers lead you to there.

    for point 3, here it is:

    @class TviewController.h;
    @interface XviewController : UIViewController
    {
    //this is XviewController.h
    //you may use `#import` other than use `@class` but on some reason you can't, if you use`#import XviewController.h` in your TviewController class.
    }
    

    //XviewController.m
    #import TviewController.h
    #import XviewController.h
    @implementation
    
    -(IBAction) backTviewController
    {
       for ( UIViewController *viewController in self.navigationController.viewControllers ) 
          if ( [viewController isMemberOfClass:[TviewController class]]{
            [self.navigationController popToViewController:viewController animated:YES];
            break;
          } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At the end of this code: UIViewController *viewController = [[UIViewController alloc] init]; UINavigationController *navigationController
I have code in my .h file as follows @interface tweetViewController : UIViewController<UIPickerViewDataSource ,UIPickerViewDelegate>
I have an UIViewController into an navigationController.All I want is when I rotate from
I have put an UITableView inside a UIViewController and have copied code from UITableViewController
I have the following code: @interface AddResident : UIViewController { IBOutlet UITextField *FirstName; IBOutlet
I have a UIViewController I am loading from a xib file and pushing onto
I have a UIViewController (parentVC) to which I add a UITableViewController as follows (it
I have an UIViewController named MainViewController I have another UIViewController named LeftSharingViewController; I would
I have a UIViewController which is created programmatically. I include the following code in
I have a UIViewController Class Aplha that calls another UIViewController Class Beta in a

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.