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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:03:21+00:00 2026-06-13T15:03:21+00:00

In the Cell.m i have written this code to add some strings to a

  • 0

In the Cell.m i have written this code to add some strings to a dictionary:

- (void)textViewDidEndEditing:(UITextView *)textView {

if (cellIndex == 0) {
[[dataSource objectAtIndex:dataIndex] setObject:self.cellTextView.text forKey:@"Usersmell"];
}
if (cellIndex == 1) {
    [[dataSource objectAtIndex:dataIndex] setObject:self.cellTextView.text forKey:@"Usertaste"];
}
if (cellIndex == 2) {
    [[dataSource objectAtIndex:dataIndex] setObject:self.cellTextView.text forKey:@"Usersuits"];
}
if (cellIndex == 3) {
    [[dataSource objectAtIndex:dataIndex] setObject:self.cellTextView.text forKey:@"Usernotes"];
}

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Objects.plist"];

//removed some code here that gets the index of dictionary for replacement, then:

[allObjectsArray replaceObjectAtIndex:index withObject:[NSDictionary dictionaryWithDictionary:[dataSource objectAtIndex:dataIndex]]];
[allObjectsArray writeToFile:path atomically:YES];
}

And then, in the TableViewController.m:

-(IBAction)doneButtonPressed:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}

The user is now back to the DetailViewController with the info about the object plus the new info added by the user. The info is extracted from the plist in viewWillAppear.

But the problem is that if the user hits the Done button without dismissing the keyboard first (triggering textViewDidEndEditing), the text from the last edited cell is not displayed in the DetailViewController.

But if the user goes back one more step and then re-enter the object (DetailViewController), the text is there. So textViewDidEndEditing is triggered too late for viewWillAppear in the parent view to grab the text when Done button is hit.

How to solve 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-13T15:03:23+00:00Added an answer on June 13, 2026 at 3:03 pm

    In the method that handles the ‘Done’ button, call [self.view endEditing:YES] as the first line of the method. This will cause the keyboard to be dismissed allowing you to process the data before the screen is dismissed.

    -(IBAction)doneButtonPressed:(id)sender {
        [self.view endEditing:YES];
    
        [self.navigationController popViewControllerAnimated:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written this code to see different image states... UIButton *btnComment = [UIButton
I have this piece of code for reading from an excel cell: public T
I have written some vba code that selects a range from a workbook and
This is the piece of code I have written: <html> <head> <script type=text/javascript src=jquery-min.js></script>
I have written a Python program to find the carrier of a cell phone
I have written this routine to drag a TreeView node-value to drop it on
I am using Excel 2007. I have C# code written in a separate binary.
I have written this method in objectiveC (for iOS but that immaterial). My app
I have written a small program: void showrecord() { char *a[]={ O_BILLABLE_ACCOUNT,O_CUSTOMER_TYPE_INDICATOR, O_A_PARTY_MSISDN_ID,O_A_PARTY_EQUIPMENT_NUMBER, O_A_PARTY_IMSI,O_A_PARTY_LOCATION_INFO_CELL_ID,
I have written the code programmatically for my tab bar in my table view.The

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.