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

  • Home
  • SEARCH
  • 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 8192177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:07:03+00:00 2026-06-07T04:07:03+00:00

I have an app with a tab bar controller (2 tabs). In one tab

  • 0

I have an app with a tab bar controller (2 tabs). In one tab view controller, a button leads to an alert window. I want one button of the alert window to call a table view containing possible answers. I want that table view to have a done button and a title. I think that means a navigation controller has to be used. But most everything I can find on navigation controllers assumes a much more complicated situation. Here’s part of the alert window logic:

-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{ 
    if (buttonIndex == 2) {
        AnswersViewController *aVC = [[AnswersViewController alloc] init];
        [self presentViewController:aVC
                           animated:YES
                         completion:NULL];    
    }
} 

And AnswersViewController looks like this:

@interface AnswersViewController : UITableViewController
@end

@implementation AnswersViewController

- (id) init
{
    self = [super initWithStyle:UITableViewStylePlain];
    return self;
}


- (id) initWithStyle:(UITableViewStyle)style
{
    return [self init];   

}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [[self view] setBackgroundColor:[UIColor redColor]];

}

@end

This code all works as expected (an empty red UITableView appears).

Two questions I guess: 1. Is there a simple modification to what I have that can give me a done button and title in my table view? 2. If I have to go to a navigation controller (probably), how can I make a bare-bones navigation controller with a done button and title and embed the table view within it? Oh, and I want to do this programatically. And I think I prefer the done button and title to be in the navigation bar, no tool bar desired. Thanks!

  • 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-07T04:07:05+00:00Added an answer on June 7, 2026 at 4:07 am

    To get what you are looking for, you do need to use a UINavigationController. That will provide the UINavigationBar where you can display a title and also buttons.

    To implement this with a UINavigationController, you want to do smoothing like this (assuming you are using ARC, so you don’t need to worry about memory management):

    -(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    
    { 
        if (buttonIndex == 2) {
            AnswersViewController *aVC = [[AnswersViewController alloc] init];
    
            //Make our done button
            //Target is this same class, tapping the button will call dismissAnswersViewController:
            aVC.navigationItem.leftBarButtonItem =  [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissAnswersViewController:)];
    
           //Set the title of the view controller
           aVC.title = @"Answers";
    
            UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:aVC];
            [self presentViewController:aNavigationController
                           animated:YES
                         completion:NULL];
        }
    } 
    

    Then you would also implement - (void)dismissAnswersViewController:(id)sender in the same class as the UIAlertView delegate method (based on the implementation I have here).

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my app starts with a tab bar controller which have 5 tabs. At start
I have an app that uses a tab bar controller. It has five tabs.
I have a tab-Bar Controller + UINavigation Controller app. In tabs 1,2,3 I have
My iPhone app has a tab bar controller, and one of the tabs is
I have a tab-bar and navigation controller application (like Youtube app or Contacts app).
My app requires one set of tabs on the initial view, the last tab
So I have 2 tabs in tab bar controller. tab 1 is the rootController.
I have an app with a tab bar. Each tab has its own view
I have an app that is built starting from a tab bar controller. It's
My iPhone app has a tab bar controller at the bottom of the view

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.