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

The Archive Base Latest Questions

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

So I have an interesting design question regarding an app I’m developing for the

  • 0

So I have an interesting design question regarding an app I’m developing for the iPhone. I am creating an app that manipulates images, and there are different types of manipulations that can be performed. So the user opens the app, and selects what type of manipulation they want to perform, and are taken through a step by step process to perform the manipulation.

A lot of the manipulations are similar, so code can be reused here. So instead of creating a view controller for each window of each manipulation, I decided to create one view and one view controller. The view contains the steps of each image manipulation, and each time it is incremented to the next step, it reorganizes itself appropriately. The view controller is controlled by a navigation controller, and each time the user advances to the next step of whatever image manipulation they’re trying to perform (ie pushed a new view controller on the stack), I make a copy of my view object, set it to reorganize its components to the appropriate step, then send it to the new view controller which will display it.

So my question is this, for some stages of the manipulations, I need to add some buttons to a universal toolbar that is attached to view controller (since this is a modal view, this tool bar will have a home button that will enable the user to exit back to the main screen). Basically, I have a couple of questions on how I should approach this:

1) Should I simply add the toolbar to the view that I’m using, instead of the view controller. If so, how would I have the home button on the toolbar exit the modal view?

2) Should I keep the toolbar on the view controller, and have my view return a set of buttons to be added to it when the view loads? Then I guess I would have to list all of my action methods in my view controller?

3) Should I keep the toolbar on the view controller, but send a pointer from the toolbar to my view object, then add the buttons within my view class? Would I be able to add my action methods in my view class then?

Anyhow, sorry if this is complicated, and if you have any follow up questions please let me know.

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

    I finally came up with a solution for this. What I did was create a universal view controller called UIMainViewController that obviously inherits from UIViewController. I implement the toolbar like follows:

        - (void) viewDidLoad 
        {
            [super viewDidLoad];
    
            [self assembleToolbarButtons];
            [[self navigationController] setToolbarHidden:NO]; 
            [self setToolbarItems: toolbarButtons];
            [[[self navigationController] toolbar]setBarStyle:UIBarStyleBlack];
        }
    
        - (void) assembleToolbarButtons
        {
            NSMutableArray *toolbarButtonsTemp = [[NSMutableArray alloc] init];
            [self setToolbarButtons: toolbarButtonsTemp];
            [toolbarButtonsTemp release];
    
            if ([self mode] == UIMainViewControllerMainMode)
            {
                UIBarButtonItem *createAPictureButton = [[UIBarButtonItem alloc] initWithTitle:@"Create" style: UIBarButtonItemStyleBordered target:self action:@selector(loadCreateAPictureModalViewController)];
                UIBarButtonItem *accountButton = [[UIBarButtonItem alloc] initWithTitle:@"Account" style: UIBarButtonItemStyleBordered target:self action:@selector(loadAccountModalViewController)]; 
                UIBarButtonItem *helpButton = [[UIBarButtonItem alloc] initWithTitle:@"Help" style: UIBarButtonItemStyleBordered target:self action:@selector(loadHelpModalViewController)]; 
    
                [[self toolbarButtons] addObject: createAPictureButton];
                [[self toolbarButtons] addObject: accountButton];
                [[self toolbarButtons] addObject: helpButton];
    
                [createACaptionButton release]; 
                [accountButton release];
                [helpButton release];
            }
            else 
            {
                UIBarButtonItem *homeButton = [[UIBarButtonItem alloc] initWithTitle:@"Home" style: UIBarButtonItemStyleBordered target:self action:@selector(exitModalViewController)]; 
    
                [[self toolbarButtons] addObject: homeButton];
    
                [homeButton release];
            }
    
    
        }
    
    -(void) loadCreateAPictureModalViewController
    {   
        CreateAPictureViewController *createAPictureViewController = [[CreateAPictureViewController alloc] initWithMode:UIMainTableViewControllerModeModal];
        UINavigationController *createAPictureNavController = [[UINavigationController alloc] initWithRootViewController: createAPictureViewController];
    
        [[createAPictureNavController navigationBar] setBarStyle:UIBarStyleBlack];
        [self presentModalViewController:createAPictureNavController animated:YES];
    
        [createAPictureNavController release];
        [createAPictureViewController release]; 
    }
    
    -(void) loadAccountModalViewController
    {
        AccountViewController *accountViewController = [[AccountViewController alloc] initWithMode:UICaptionDistractionTableViewControllerModeModal];
        UINavigationController *accountNavController = [[UINavigationController alloc] initWithRootViewController: accountViewController];
    
        [[accountNavController navigationBar] setBarStyle:UIBarStyleBlack];
        [self presentModalViewController: accountNavController animated:YES];
    
        [accountNavController release];
        [accountViewController release];
    }
    
    -(void) loadHelpModalViewController
    {
        HelpViewController *helpViewController = [[HelpViewController alloc] initWithMode:UICaptionDistractionTableViewControllerModeModal];
        UINavigationController *helpNavController = [[UINavigationController alloc] initWithRootViewController: helpViewController];
    
        [[helpNavController navigationBar] setBarStyle:UIBarStyleBlack];
        [self presentModalViewController: helpNavController animated:YES];
    
        [helpNavController release];
        [helpViewController release];
    }
    
    -(void) exitModalViewController
    {
        [self dismissModalViewControllerAnimated:YES];
    }
    

    So for my app, on each viewcontroller it will have a toolbar at the bottom that have the basic buttons for creating a picture, accessing the account, or accessing help. If one of these buttons is accessed, it will launch a modal view which will have the home button to exit the modal view (when the UIMainViewController is created, one of it’s parameters tells it which mode it is in, and thus which toolbar buttons to add.

    But the main thing is I created a class mutablearray varialbe to store the toolbar buttons and then the buttons are created in “assembleToolbarButtons”. Now any class that inherits from UIMainViewController can override the assembleToolbarButtons in order to add it’s own buttons on top of the main ones that have already been added.

    As far as what I mentioned initially in using one UIView and having it reorganize itself, and only one uiviewcontroller, I avoided this and instead just created separate view controllers for each step and separate views so as to adhere to MVC more.

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

Sidebar

Related Questions

I have an interesting situation where I need to deploy an ASP.NET MVC app
I have an interesting question. Imagine I have a lot of data changing in
I have an interesting SQL problem that I need help with. Here is the
I have an interesting problem. The basis of the problem is that my last
I have a design question about the use of Hibernate annotations and DAO pattern.
I've got an interesting design question. I'm designing the security side of our project,
I have an interesting project in mind, and I have a question. You can
So I have an interesting problem that's been the fruit of lots of good
I have a question that I've been trying to answer for some time now
(Sorry if it's a trivial question.) I have documents that looks like this (Python

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.