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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:45:08+00:00 2026-06-07T02:45:08+00:00

I would like some expert MVC design feedback please: I have a UITabBarController with

  • 0

I would like some expert MVC design feedback please:

I have a UITabBarController with 2 tabs, each of the tabs leads to a Nav controller with a stack of VC.

The last view Controller on the 1st tab path will show an image. I would like that image to be stored in a table and viewed anytime the second tab is selected.

How do I send this image from the 1st tab-> NaVController->last VC (image VC) to 2nd tab -> NavController->table VC?

I have a couple of options:

1- Create a class method in the tableVC and have the imageVC call that class method and pass that image to be saved directly into user defaults. This seems to go against MVC

2- Create a protocol in imageVC with a method and delegate property and have the table VC adopt that method to save the image in an array. The problem here is that the only place to set the delegate is in ViewDidLoad:

[[[[self.tabBarController.viewControllers objectAtIndex:0] viewControllers] objectAtIndex:1] setDelegate:self];

The problem here is that if the user select the second tab from the start, the app will crash because obviously the viewControllers have not been loaded on the nav stack for the first tab. In the same token, if the user sees 1 image first and then selects the second tab, it will execute and set the delegate but without saving that first selected image.

There must be an easier way…..

Thanks in advance
KB

  • 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-07T02:45:12+00:00Added an answer on June 7, 2026 at 2:45 am

    I think that you should separate your data model from your view controllers a little more. Following the MVC approach, a model should not know about how its represented. So, making a change to the model in ImageVC should not involve direct calls to any other VC.

    I’d create a separate entity, e.g. SelectedImages, and add images from ImageVC to it, and have TableVC read from it when it needs to display itself. SelectedImages could be a property in the app delegate, a Core Data entity, a singleton class, or something like that.

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

Sidebar

Related Questions

I would like to export some macros that I have defined and be able
I have an Excel table with some data that I would like to export
I would like some of my preferences to have icons, like the Settings app.
I would like to know from some iphone-Audio expert if there is a way
That is a common question, but I would like to hear some expert opinions.
I would like some advice on the best approach to use in the following
I am developing a site and i would like some simple markup. I would
I am learning C++ exceptions and I would like some clarification of the scenario:
I am designing RESTful Api's and would like some advice on designing an API
Hi I seem to be at an ORM Tool crossroad and would like some

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.