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

The Archive Base Latest Questions

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

I have a problem with switching the views in iPhone simulator.I had written a

  • 0

I have a problem with switching the views in iPhone simulator.I had written a code that can switch views back and forward but now when I had run it in the simulator I found that the app only switches the view forward but I am unable to switch the view back. I am unable to trace out the problem in my code. Will be thankful if anyone had helped me trace out the problem with my code.

My code is :

SwitchingViewsViewController.h

#import <UIKit/UIKit.h>

@interface SwitchingViewsViewController : UIViewController
{

}
-(IBAction)switchback:(id)sender;
@end

SwitchingViewsViewController.m

#import "SwitchingViewsViewController.h"
#import "secondview.h"

@interface SwitchingViewsViewController ()

@end

@implementation SwitchingViewsViewController

-(IBAction)switchback:(id)sender
{
    secondview *second = [[secondview alloc] initWithNibName:nil bundle:nil];
    [self presentModalViewController:second animated:YES];
}



- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
// Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:  (UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}

@end

secondview.h

#import <UIKit/UIKit.h>

@interface secondview : UIViewController
{

}
-(IBAction)switchview:(id)sender;
@end

secondview.m

#import "secondview.h"
#import "SwitchingViewsViewController.h"

@interface secondview ()

@end

@implementation secondview


-(IBAction)switchview:(id)sender
{
    SwitchingViewsViewController *second = [[SwitchingViewsViewController alloc]  initWithNibName:nil bundle:nil];
    [self presentModalViewController:second animated:YES];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end

Thanks in advance.

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

    use this in second view

    -(IBAction)switchview:(id)sender
    {
    [self dismissModalViewControllerAnimated:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I build my first iPhone application and I have a problem with switching views.
I have a problem with switching views. I'm using a simulator with xcode 4.2
I'm writing my first iPhone application and I'm having trouble switching views. I have
I have an iphone application that crashes when I switch between two of the
I have a problem with switching images in android. I want to create animation
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have a problem with some simple code. The photo's, either picked or taken
I have encountered a problem in my program that has me somewhat stumped. I
I have two views of some data: a list view (a ListBox now, but
I have a problem switching the content of a div using jQuery functions clone

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.