I have an NSMutableDictionary in my mainViewController which loads some text into my DetailViewController. I want the user to be able to add to the text and then save the changes back to the NSMutableDictionary so when the DetailViewController is show again the changes show up. I have researched this some but for the most part I can only find where this can be done in the UITextField. I would like to use the UITextView in case the user wants to add a lot of text which would be longer than the UITextField field. Is This possible to do?
This is the NSMutableDictionary in my mainViewController;
this isn't working and I'm not sure how to proceed. It is very difficult to find tutorial/examples of this.
This is the NSMutableDictionary in my mainViewController;
Code:
`detailViewController *detailView = [[detailViewController alloc] initWithNibName:@"detailViewController" bundle:nil];
if ((int)index == 0) {
NSMutableDictionary *aDictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"some existing text", @"textkey", nil];
detailView.aDictionary = aDictionary;
}`
and this is the code to load it in the DetailViewController;
self.theText.text =[(NSMutableDictionary *)aDictionary objectForKey:@"textkey"];
I have a right navigationBarButton that I want to hide the keyboard and save the text back to the NSMutableDictionary at the same time when touched.
`-(void)doneEditing:(id)sender
{
[(NSMutableDictionary *)aDictionary writeToFile:@"textkey"];
[theText resignFirstResponder];
}
}`
this isn't working and I'm not sure how to proceed. It is very difficult to find tutorial/examples of this.
Last edited by a moderator: