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

  • Home
  • SEARCH
  • 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 8351471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:38:23+00:00 2026-06-09T08:38:23+00:00

I am using the approach described in this stackoverflow posting to retrieve values from

  • 0

I am using the approach described in this stackoverflow posting to retrieve values from a textfield. My problem is that the tableview is presented modally and I have a save button that validates the input and stores it.

The problem is that the textFieldDidEndEditing method is not called when the user clicks an UIBarButtonItem (= the save button, which closes the modal view).

In this event (when the user wants to save the input) I would like to validate it. But the values are stored in properties in the textFieldDidEndEditing. Due to the fact that this method is not called, I cannot validate the input values correctly.

Does anyone have a hint or solution on this?

Thanks in advance!

  • 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-09T08:38:25+00:00Added an answer on June 9, 2026 at 8:38 am

    Okay, here we go:

    Thanks to @Lefteris and his idea with storing the current index. Due to the fact that I cannot store the index into the tag attribute I decided to store the active indexPath and additionally the active textField. (I know, a reference to the UITextField would have been enough but I needed it for other stuff)

    First I have added these two properties:

    @property (nonatomic, strong) NSIndexPath *activeIndexPath;
    @property (nonatomic, strong) UITextField *activeTextField;
    

    Then I implemented textFieldDidBeginEditing: and textFieldDidEndEditing: of UITextFieldDelegate.

    - (void)textFieldDidBeginEditing:(UITextField *)textField
    {
        NSIndexPath *indexPath = (NSIndexPath*)[self.tableView indexPathForCell:(UITableViewCell*)[[textField superview] superview]];
    
        self.activeTextField = textField;
        self.activeIndexPath = indexPath;
    }
    
    - (void)textFieldDidEndEditing:(UITextField *)textField 
    {
        NSString *input = textField.text;    
    
        //assuming values from input textfield into corresponding properties
        [self assumeInput:input withIndexPath:self.activeIndexPath];
    
        self.activeTextField = nil;
        self.activeTextField = nil;
    }
    

    In textFieldDidEndEditing: I am storing the values into my properties (such as self.firstName, self.lastName, and so on…) by using the method [self assumeInput:input withIndexPath:self.activeIndexPath];.

    In my saveAction-Method I am storing the value from the currently active TextField.

    - (IBAction)saveButtonClicked:(UIBarButtonItem *)sender 
    {    
        //assuming input from active field (didEndEditing _not_ called right now!)
        [self assumeInput:self.activeTextField.text withIndexPath:self.activeIndexPath];
    
        //test output
        NSLog(@"firstName: %@", self.firstName);
        NSLog(@"lastName: %@", self.lastName);
        NSLog(@"email: %@", self.email);
        ...
    }
    

    … and that’s it!

    Hope it helps! Thanks to @Lefteris for his input.

    Best,
    Chris

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

Sidebar

Related Questions

I'm using a naive approach to this problem, I'm putting the words in a
I've been using the following approach to create components and return values from Swing
I'm using an approach for this thread in order to make gallery change one
I'm using this approach to store data in a global array hosting an http
I was reading today about OOCSS which says by using that approach have 2
So, I'm using this approach to be able to drag an image: Dragging an
In my project I am using the following approach to querying data from the
I'm using quasi the module approach From a Table - Using Locals Internally as
This is a frequently recurring problem of generating a tree from a flat list
I'm attempting to use this approach, described by Marco Arment, for checking if a

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.