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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:50:14+00:00 2026-05-12T05:50:14+00:00

I’m creating a custom ViewController. This VC needs to load some data that is

  • 0

I’m creating a custom ViewController. This VC needs to load some data that is known in the event that creates it and pushes it to the top of the NavigationController that it is going to be part of.

My question is, how should I pass data from the view that handles the custom ViewController’s creation into that custom ViewController.

I’ve thought of four possible options, and I was hoping to get feedback on why each one is good or not for this functionality.

1) Expose public properties in the custom ViewController and set the UI elements in the view based on those properties in – (void) ViewDidLoad.

2) Expose the actual UI elements themselves and set their .text/.image/.whatever attributes as the ViewController is being created.

3) Create a custom constructor for the custom view and pass in the values I need to set up the UI elements

4) Create a custom model that both views have access to, set the data before the CustomView is created/pushed, and access that data in the ViewDidLoad event.

I’m still new to all of this, and I want to make sure that I understand the proper handling of these handoffs of data. It seems like something like this is probably a simple answer, but I’m still a little confused and its probably really important to do this right to avoid memory loss/leaks.

Also, in case anyone cares, I’m using Stanford’s CS193p class on iTunes U and Mark/Lamarche’s “Beginning iPhone Development” to teach myself cocoa for the iPhone. I’m working on an application with a NavigationController and a couple ViewControllers (Presence 1 if you’re familiar with 193p).

  • 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-12T05:50:14+00:00Added an answer on May 12, 2026 at 5:50 am

    Well, I believe there are advantages & disadvantages to each of those methods depending on your requirements…often it will require some combination of approaches. I believe the most common, for me anyway, is to do something like this where you give it enough to get started.

    MyViewController *vc = [[MyViewController alloc] init]; // (or initWithNibName:bundle:)
    // transfer vc values here
    vc.value1 = aValue;
    vc.value2 = anotherValue;
    [self.navigationController pushViewController:vc animated:YES];
    [vc release];
    

    After your view controller is instantiated you have an opportunity to pass objects to it. Say MyViewController is a detail view then you’d give it the object it will be displaying the details for. Or, if it’s a table view you can give it the NSArray it will need for display. Then in viewDidLoad or awakeFromNib or awakeFromCoder, or… you can fill out the view…so to speak.

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

Sidebar

Ask A Question

Stats

  • Questions 194k
  • Answers 194k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer From $GIT/Documentation/RelNotes-1.6.2.txt: "git checkout -" is a shorthand for "git… May 12, 2026 at 6:44 pm
  • Editorial Team
    Editorial Team added an answer There is a Forum Nokia article about how to launch… May 12, 2026 at 6:44 pm
  • Editorial Team
    Editorial Team added an answer There is already research going on in this area. Digital… May 12, 2026 at 6:44 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.