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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:13:01+00:00 2026-06-19T00:13:01+00:00

I am new in iOS programming. What I am trying to do is: I

  • 0

I am new in iOS programming.

What I am trying to do is:

I have some views in a storyboard and I’d like to switch between the views programatically. For example, when a button is clicked, I call a method and I want to change views here (I can call the method successfully). The buttons are also created programatically in different positions.

I have searched and I think it happens with NavigationController. I have a navigation controller which I created like so: menu Editor -> Embed In -> NavigationController. How could I do this using this NavigationController?

@Madhu and @Dilip ,I found a solution with xib filed class

icerik *secondViewController = [[icerik alloc] initWithNibName:@"icerik" bundle:nil];

    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:secondViewController];
    navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
    navigationController.topViewController.title = @"SecondViewController";

    //[self presentModalViewController:navigationController  animated:YES];

    if([self respondsToSelector:@selector(presentViewController:animated:completion:)])
        [self presentViewController:navigationController animated:YES completion:^{/* done */}];
    else if([self respondsToSelector:@selector(presentViewController:animated:)])
        [self presentModalViewController:navigationController animated:YES];

I have a class with xib file named icerik, I solved it like this. It is opening but when I want to turn back, What can I do it ?

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

    You can create btn using this code:

    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [button addTarget:self action:@selector(aMethod) forControlEvents:UIControlEventTouchDown];
    [button setTitle:@"Show View" forState:UIControlStateNormal];
    button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
    [self.view addSubview:button];
    

    and for going to another vc use this code,if you want navigation bar:

    -(void)aMethod
    {
    SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    
        UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:SecondViewController];
        navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
        navigationController.topViewController.title = @"SecondViewController";
    
        [self presentModalViewController:navigationController               animated:YES];
    }
    

    Else use this code:

    -(void)aMethod
    {
    SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    
        [self presentModalViewController:secondViewController            animated:YES];
    }
    

    And for come back to frist vc fromm second vc add this code in second vc.

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(backAction:)]; 
        self.navigationItem.leftBarButtonItem = closeButton;
    }
    - (void)backAction:(id)sender {
        [self dismissModalViewControllerAnimated:NO];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm just new to iOS Programming, so appreciate for any help. I'm trying to
I am fairly new to Objective C and iOS programming but am constantly trying
I'm very very new to iOS programming but I already have a big issue
New to ios programming so for practice I am trying to make a simple
Ok guys, so I am new to iOS programming. Im trying to build a
i am very new to iOS programming and encountered a issue. I have a
I'm fairly new to iOS programming, but have a basic understanding of it. I
Somewhat new to ios programming. Trying to use AVQueuePlayer and playing multiple videos in
I am very new to iOS Programming and have been learning for only a
I am new to ios programming, need to implement something like a google search

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.