Reputation: 457
Notes as a UITextView in navigation base application .How to save text data after writing in notes .How to identify return from keyboard. need to set any key for return Notes.I need to store device. When user enter the text in notes , after second time able to see previous page also, if its possible write to previous page end of line to start that is appended. plz post some tutorial link , because i am not much about this topic, i need ti understand concept .
Upvotes: 1
Views: 4077
Reputation: 10782
Create function that is called on a button click, test if the user has hit enter, or test if the user has removed focus from the UITextView:
-(IBAction)saveText
{
Get the path to the file you want to create:
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [documentPaths objectAtIndex:0];
NSString *documentTXTPath = [documentsDirectory stringByAppendingPathComponent:@"savedText.txt"];
Get the text from the UITextView (replace textView with the name of your UITextView):
NSString *savedString = textView.text;
Write the string to the file:
[savedString writeToFile:documentTXTPath atomically:YES];
}
Upvotes: 3