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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:22:13+00:00 2026-05-26T06:22:13+00:00

In my app I’ve added a label to a view, connected it to an

  • 0

In my app I’ve added a label to a view, connected it to an outlet but nothing shows up when I first assign this outlet from another view controller and then call pushViewController to display it. Here’s the code before pushing next view that display the label:

CustomViewController *vc = [[CustomViewController alloc] init];
vc.lbl_price.text = self.label_price.text; // lbl_price is defined as a property in CustomViewController and label_price is defined in current view controller
[self.navigationController pushViewController:vc];

In the CustomViewController viewDidLoad method I added this instruction to see if it should work

NSLog(@"Price=%@",lbl_price); // it actually prints out what was previously assigned

But it doesn’t show into the label!

Any idea why ?

Stephane

  • 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-26T06:22:14+00:00Added an answer on May 26, 2026 at 6:22 am

    Even if view controller is created its view hierarchy may not (and so all subviews will still be nil), for optimization reasons it may not be loaded until you try to actually access controller’s view. You have two options to solve your problem:

    1. Store all values in separate non-UI variables and assign them to UI components with controller is going to appear:

      // Before push controller
      vc.myPriceText = self.label_price.text;
      
      // In controller's viewWillAppear:
      self.lbl_price.text = self.myPriceText;
      
    2. Make [vc view] call to force controller to load its view hierarchy:

       CustomViewController *vc = [[CustomViewController alloc] init];
       [vc view];
       vc.lbl_price.text = self.label_price.text; 
       [self.navigationController pushViewController:vc];
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My app uses a WebRequest at certain points to get pages from itself. This
App.Views.VideoView = Backbone.View.extend({ initialize: function() { _.bindAll(this, 'render'); this.model = this.options.model; this.render(); }, render:
My app is expanding, but the reqs dictate that there should be only one
App A has this BroadcastReceiver in its manifest (within <application>): And this receiver: public
The app I'm working on is relatively simple but it is throwing memory warnings.
My app uses the android.support.v4.view.ViewPager class. For each page in the ViewPager, I want
App runs on simulator on my MacBook Air, but not on iMac. I have
My app runs fine in the ios 4.3 simulator, but not the ios 5
My app crashes, but generates no exception in the console and no crash log
The app in question is already localized into a few languages, but I'm adding

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.