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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:48:35+00:00 2026-05-23T23:48:35+00:00

I have the following code for UITextField . The problem I’m having is that

  • 0

I have the following code for UITextField. The problem I’m having is that the text does not persist. For example, when I present a modal view, then dismiss it, the UITextField does not have the text anymore in it. I want the text to remain there until I dimiss that view with the text field.

I am displaying the UITextField like this:

UITextField *nameTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)];
nameTextField.delegate = self;
[nameTextField addTarget:self action:@selector(editingEnded) forControlEvents:UIControlEventEditingDidEnd];
[nameTextField setEnabled: YES];
self.myTextField = nameTextField;
[nameTextField release];

Then I have:

- (void)editingEnded
{
    NSString *tempRoutineName = self.myTextField.text;
    self.routineName = tempRoutineName;
    [tempRoutineName release];
 }
  • 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-23T23:48:36+00:00Added an answer on May 23, 2026 at 11:48 pm

    Instead of editingEnded, Implement the UITextFieldDelegate protocol. Go to the textFieldDidEndEditing method and reassign the value of text in it.

    Like,

    -(void) textFieldDidEndEditing:(UITextField *)textField{
    
    if (textField.tag ==0){
        self.myTextField = textField; 
    
      // myTextField is a property
        }
    

    Now in the in the viewDidLoad method or the viewWillAppear method, go ahead and assign this value back to the textField.

    If necessary use [tableView reloadData] if this is used in a tableView or use [self reloadInputViews] (if necessary).

    Then again, its all logical. Nothing too complex in code.

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

Sidebar

Related Questions

Let's say I have the following code: IBOutlet UITextField* nameTextField; IBOutlet UILabel* greetingLabel; I'd
I have the following code: @interface AddResident : UIViewController { IBOutlet UITextField *FirstName; IBOutlet
Hi I am using the following code for a text box UITextField *txt_field =
I have the following code... - (void)textFieldDidBeginEditing:(UITextField *)textField { //some code here... NSInteger theTag
I have following code in VS2008 If Linq.Enumerable.Contains(Of String)(selectedUsersRoles, RoleCheckBox.Text) Then RoleCheckBox.Checked = True
I have the following code: //RootViewController.h: #import <UIKit/UIKit.h> @interface RootViewController : UIViewController{ IBOutlet UITextField
I'm using the following code in my UITextField delegate to limit the characters that
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section
I have following code in my application: // to set tip - photo 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.