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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:26:59+00:00 2026-06-08T00:26:59+00:00

I am stuck trying to set and retrieve the text in a UITextField object

  • 0

I am stuck trying to set and retrieve the text in a UITextField object on titleViewController.

I have a Journal object that has a reference to the titleViewController object, but I can not seem to set the text value for the UITextField.

I have an outlet to the UITextField object in the titleViewController, and Journal can see it, but when I write to code to set the value nothing happens when it is run.

There is no errors that pop up in XCode or the Log. I know it should work as the set up works for accessing custom methods in other such viewControllers being managed by the same Journal.

-EDIT-

Here is a code sample as requested:

//Get viewController from Array
TitleVC *titlePage = [_PageArray objectAtIndex:0];

//Get string from Dictionary
NSString *test = [_saveDictionary objectForKey:@"Name"];

//This is one of the attempts to set the UITextField 
//FIXED by Tomy211(but still does not work)
[titlePage.textName setText:test];

//This is attempting dot notation
titlePage.textName.text = test
titlePage.textName = test //Wrong I know but had to test

//Also made sure test was a proper string
NSLog(test) //Displayed "Dan" as Expected

This is in Journal.m which accessed a reference to the titleVC from a storyboard using this code:

-(UIViewController *)loadView:(NSString *)viewID{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:viewID];
    return viewController;
}

The ViewController returned from that method is used in displaying the View in a scrollview, and I havent had an issue with accessing methods from the ViewControllers this way.

All I want to do is let Journal.m set and read the value from textName which is an outlet connected to a UITextField.

-UPDATE-

I checked and discovered I can read the value of the textField but not write to it.

-FINAL UPDATE-

I found the issue with my code. The code was correct(minus the correction by Tomy211), but the issue was where I was calling the code. I was calling the method before the view was displayed, so when the view did get displayed it revert back to the default values.

Note to all that have similar issues:
Check to make sure the view is being displayed before updating a value of a UIObject part of the view. If you have to update values with the view not displayed, use instance variables and have the UIObject get their values from them on the viewDidLoad method.

  • 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-08T00:27:01+00:00Added an answer on June 8, 2026 at 12:27 am

    The problem was I tried to update the TextField objects before the view has been loaded.
    Moving the method call to after the point I load the view fixes the problem. I have updated my question to reflect what was correct, and what was incorrect.

    Note to all that have similar issues: Check to make sure the view is being displayed before updating a value of a UIObject part of the view. If you have to update values with the view not displayed, use instance variables and have the UIObject get their values from them on the viewDidLoad method.

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

Sidebar

Related Questions

I'm stuck trying to solve this. I'm plotting some information that I have in
I am trying to set up a Satchmo site, but I am stuck at
I set myself this rather simple sounding challenge but now I am stuck trying
I am stuck on a issue. I am trying to set user-environment variables using
Trying to set-up a git server on my local dev machine and have been
I've been stuck trying to write this regular expression I need. Basically, I have
Hi i am trying to set up an RSA cryptosystem i have all the
I'm stuck trying to create a result page that lists details based on a
I'm trying to set up a print job completely by code. I have my
I'm stuck trying to figure this one out.. We currently have a date criteria

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.