Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dbramhall

macrumors newbie
Original poster
Aug 1, 2011
16
0
England, UK
I am trying to store the contents of an NSTextView so that each time the user runs the application, the NSTextView has the same text they exited with. For example, if the user typed in "Hello!" and then quit the application, I would like it to open up with "Hello!" still in the same place. I believe it is NSUserDefaults but I'm not too such as to how to go about implementing it...

Thanks in advance!
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,425
A sea of green
Break It Down.

1. How would you preserve the text from the text-field?

1a) Get the text from the text field.
1b) Store it in a named NSUserDefaults string.


2. How would you restore the text back to the text-field?

2a) Get the name named NSUserDefaults string.
2b) Store it into the text field.


If you're looking for the point where you'd do #2, look at awakFromNib:.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.