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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:44:55+00:00 2026-05-17T20:44:55+00:00

I want to be able to switch between a UITableView and a standard UIView

  • 0

I want to be able to switch between a UITableView and a standard UIView in a Parent View. Basically I have a UITableView that shows on load displaying a log of information. I want to have a segment control in the header of the Window that when the user taps, transitions to a Graph View which is a standard UIView.

The UIViewController in question needs the ability to be pushed from a RootViewController stack.

I have tried a number of things, but I can’t seem to get this to work. Does anyone have any code examples or suggestions on how this could be done?

  • 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-17T20:44:55+00:00Added an answer on May 17, 2026 at 8:44 pm

    It’s actually not as difficult as it first seemed. Basically if you have a ParentViewController with a blank view and a NavController on top. Place the segment control in the center view of the NavController.

    Then you just simply switch ViewController views when the segment control changes. The only thing you have to do is keep a pointer to the currentview and remove that before adding the new view to the parentVC. Code below:

    - (void)showView
    {
        if (_currentView != nil)
            [_currentView removeFromSuperview];
    
        if (segmentControl.selectedSegmentIndex == 0)
        {
            if (_graph == nil)
                _graph = [[DrawGraphViewController alloc] initWithNibName:@"DrawGraphViewController" bundle:[NSBundle mainBundle]]; 
    
            self.navigationItem.rightBarButtonItem = nil;
            _currentView = _graph.view;
    
            [contentView addSubview:_graph.view];
            [_graph reloadGraph];
        }
        else if (segmentControl.selectedSegmentIndex == 1)
        {   
            if (_log == nil)
                _log = [[LogTableViewController alloc] initWithNibName:@"LogTableView" bundle:[NSBundle mainBundle]];
    
            self.navigationItem.rightBarButtonItem = self.editButtonItem;
            _currentView = _log.view;
            [contentView addSubview:_log.view];
            [_log loadData];
        }   
        else {
            if (_export == nil)
                _export = [[ExportViewController alloc] initWithNibName:@"ExportView" bundle:[NSBundle mainBundle]];
    
            _currentView = _export.view;
            [contentView addSubview:_export.view];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a matplotlib figure that I want to be able to switch between
I have two apps that I want to be able to switch between without
I have three Microsoft Access databases. I want to be able to switch between
I have GridView and I want to be able to switch between adapters. Context:
I want to be able to take an image that i have already captured
I have an iphone app that I want to be able to configure to
I want to be able to switch between two equals-Implementations, but I'm not sure
I want to be able to switch from the current db to multiple dbs
I use eclipse and svn 1.6 What I basically want is to be able
I need to be able to switch between two third-party applications based on the

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.