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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:47:26+00:00 2026-05-24T12:47:26+00:00

In iOS, my views work individually but I can’t switch between them. Now after

  • 0

In iOS, my views work individually but I can’t switch between them.

Now after a lot of google-ing around I’ve fond that the navigation based app would work great with the stack for views. The problem is all my views are nib/xib-less and custom tailored in the source code. Because of that I need my own UINavigationController and push and pop views by hand/code. Since every tutorial is either nib/xib and IB bound or just a mash of code snippets I need a concrete example how to do it.

A simple example with 2 programmatically created view (can be empty just have to use loadView instead of initializing with a nib/xib) and a working stack (a push and a pop of the views like: load app,create some root view if needed, push one view and from that view push the second one and then pop them) would be awesome, or at least a tutorial in that way with the whole source of the project and not snippets.

Thanks in advance.

EDIT: After some extra thinking, a little more clarification wouldn’t be bad. My app will basically consist of 5 or 6 views which will be called form their respective previous view, i.e. a drill-down app.

  • 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-24T12:47:26+00:00Added an answer on May 24, 2026 at 12:47 pm

    Here’s a brief code, only the essential parts:

    CodeViewsPushingAppDelegate.m

    #import "CodeViewsPushingAppDelegate.h"
    #import "ViewNumberOne.h"
    @implementation CodeViewsPushingAppDelegate
    
    @synthesize window = _window;
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:    (NSDictionary *)launchOptions
    {
        UINavigationController *navController = [[UINavigationController alloc] init];
        ViewNumberOne *view1 = [[ViewNumberOne alloc] init];
        [navController pushViewController:view1 animated:NO];
        [self.window addSubview:navController.view];
        [self.window makeKeyAndVisible];
        return YES;
    }
    

    ViewNumberOne.h

    #import <UIKit/UIKit.h>
    
    @interface ViewNumberOne : UIViewController
    {
        UIButton *button;
    }
    
    - (void)pushAnotherView;
    
    @end
    

    ViewNumberOne.m

    #import "ViewNumberOne.h"
    #import "ViewNumberTwo.h"
    @implementation ViewNumberOne
    
    - (void)loadView
    {
        [super loadView];
        button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        button.frame = CGRectMake(110, 190, 100, 20);
        [button setTitle:@"Push Me!" forState:UIControlStateNormal];
        [button addTarget:self action:@selector(pushAnotherView) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button];
    }
    
    - (void)pushAnotherView;
    {
        ViewNumberTwo *view2 = [[ViewNumberTwo alloc] init];
        [self.navigationController pushViewController:view2 animated:YES];
        [view2 release];
    }
    

    ViewNumberTwo.h

    #import <UIKit/UIKit.h>
    
    @interface ViewNumberTwo : UIViewController
    {
        UILabel *label;
    }
    
    @end
    

    ViewNumberTwo.m

    #import "ViewNumberTwo.h"
    
    @implementation ViewNumberTwo
    
    - (void)loadView
    {
        [super loadView];
        label = [[UILabel alloc] init];
        label.text = @"I am a label! This is view #2";
        label.numberOfLines = 2;
        label.textAlignment = UITextAlignmentCenter;
        label.frame = CGRectMake(50, 50, 200, 200); //whatever
        [self.view addSubview:label];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In order to switch between views in my iOS app, I have been using
i'm studying iOS programming. but i have a problem, which is opaque. now assume.
How can I programmatically scroll a UIWebView in Objective-C (iOS)? The only solution I
I am fairly new to Objective C and iOS programming but am constantly trying
i was wondering how can i add a view on ios Keyboard ? like
I’m making an ios application and am having trouble using a switch statement to
I write a simple ios app. All of my views are created programmatically. Here
I am thinking about how an application can be written to work on both
I'm developing on iOS and I'm building my views programmatically. I noticed that when
I'm new at iOS development. I have two table views and a content detail

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.