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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:56:46+00:00 2026-05-13T21:56:46+00:00

I have following problem: I have built a tabbar application with 4 tabs. I

  • 0

I have following problem:

I have built a tabbar application with 4 tabs. I want to pass a object/variable from the first tab controller to the third one and initialize this controller with the corresponding object.

I’ve already done some research. The best way, corresponding to a clean model approach, would be to call some initWithObject: method on the called viewcontroller.
How can I achieve this? How can I call the init method of the receivercontroller within the callercontroller? Can you give me some code example?

Edit:
To pass data between several views/classes etc simply create some Kind of data class which holds the data beeing shared between several classes. For more information follow the link:
Singleton

  • 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-13T21:56:46+00:00Added an answer on May 13, 2026 at 9:56 pm

    You need a data model object that stores the data for application.

    A data model is a customized, standalone object accessible from anywhere in the application. The data model object knows nothing about any views or view controllers. It just stores data and the logical relationships between that data.

    When different parts of the app need to write or read data, they write and read to the data model. In your case, view1 would save its data to the data model when it unloads and then view2 would read that data from the data model when it loads (or vice versa.)

    In a properly designed app, no two view controllers should have access to the internal data of another controller. (The only reason a view controllers needs to know of the existence of another controller is if it has to trigger the loading of that other controller.)

    The quick and dirty way to create a data model is to add attributes to the app delegate and then call the app delegate from the view controllers using:

    YourAppDelegateClass *appDelegate = [[UIApplication sharedApplication] delegate];
    myLocalProperty = appDelegate.someDataModelProperty;
    

    This will work for small project but as your data grows complex, you should create a dedicated class for your data model.

    Edit:

    To clarify for your specific case, you would add the call to the data model when the receiver viewController becomes active.

    Placing the data in an init method or a viewDidLoad won’t work because in a UITabBar the users can switch back and forth without unloading the view or reinitializing the view controller.

    The best place to retrieve changing data is in the viewWillAppear controller method. That way the data will be updated every time the user switches to that tab.

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

Sidebar

Related Questions

Have following String built SQL query: StringBuilder querySelect = new StringBuilder(select * from messages
I'd like some help with the following problem: I have a debian package built
How to solve the following problem? I have renamed a file from 'OldMailsCollection.aspx' to
I have the following Code for a Button, which i want to built up
I have the following: An Abstract Person object A Person object that inherits from
I have following problem: when my session expires and user clicks on Ajax.Actionlink, Logon
I have following problem, Code: String a=Yeahh, I have no a idea what's happening
I have the following problem: I have 2 Strings of DNA Sequences (consisting of
I have the following problem: I have overridden popViewControllerAnimated:(BOOL)animated of UINavigationController because I would
I have the following problem, I am implementing a queue abstraction with RavenDB in

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.