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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:21:26+00:00 2026-06-09T00:21:26+00:00

I am using Xcode 4.3 and I have a label in one view controller

  • 0

I am using Xcode 4.3 and I have a label in one view controller that I want to update the text in a text field in another view controller. How should I do this?

  • 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-09T00:21:28+00:00Added an answer on June 9, 2026 at 12:21 am

    You should put the text in your model class (assuming that you have one; if you don’t, you need to create it). When the end-user edits the text field, your code should change the string in your model; when the label displays, you should read its text from the model. The easiest way of sharing your model among multiple classes is to define a singleton.

    Header:

    @interface Model : NSObject
    @property (NSString*) labelText;
    +(Model*)instance;
    @end
    

    Implementation:

    @implementation Model
    @synthesize labelText;
    +(Model*)instance{
        static Model *inst;
        static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{
            inst = [[Model alloc] init];
        });
        return inst;
    }
    -(id)init {
        if (self = [super init]) {
            labelText = @"Initial Text";
        }
        return self;
    }
    @end
    

    Using the model:

    // Setting the field in the model, presumably in textFieldDidEndEditing:
    // of your UITextField delegate
    [Model instance].labelText = textField.text;
    
    // Getting the field from the model, presumably in viewWillAppear
    myLabel.text = [Model instance].labelText;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Xcode I have View A that navigates to View B. Upon pressing the
Currently using Xcode 4.2 and I have two view controllers (1 and 2). I
I'm using Xcode 4.3 and I have followed this user's steps to create the
I have an application in XCode using the sqlite/coredata database and that has already
Hey guys. I have an app in Objective C (using xcode) that I would
I am using xcode (3.2.3) for an iPhone project that I have checked out
I am using XCode 4.0.2 for a iOS4 project. I have this class method
In my Xcode 4.2 storyboard, i have 2 UIViewControllers , This one time and
I have created a new Xcode project using Storyboards (tab view template). I added
I am using Xcode 4.2.1 and I have this problem running an existing application

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.