开发者

Update text from UITextView to Plist

I have a TestData.plist stored in the resource folder and when the content is displayed in the textview i want it to be editable in a sense that user can edit and save the text on textview to the same TestData.plist file. what is the b开发者_JAVA百科est way to do it?I am a total noob in iphone dev. Need help please..


You cannot save it to the same TestData.plist. Resources included with your app are read-only.

What you should do is copy the TestData.plist to the ~/Documents directory and have the working copy there. Like when your app starts, do the following:

if ~/Documents/TestData.plist does not exist:
    copy Testdata.plist to ~/Documents/TestData.plist
open ~/Documents/TestData.plist

You can find the ~/Documents directory with:

NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)

Having your 'document' in ~/Documents also means that it will be backed-up by iTunes when the user synchronizes his or her device.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜