将文本从 UITextView 更新到 Plist
我有一个 TestData.plist 存储在资源文件夹中,当内容显示在 textview 中时,我希望它是可编辑的,用户可以编辑 textview 上的文本并将其保存到同一个 TestData.plist 文件中。最好的方法是什么?我是 iPhone 开发中的菜鸟。需要帮助请..
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 best way to do it?I am a total noob in iphone dev. Need help please..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法将其保存到同一个 TestData.plist 中。您的应用程序中包含的资源是只读的。
您应该做的是将 TestData.plist 复制到 ~/Documents 目录并在那里保存工作副本。就像您的应用程序启动时一样,执行以下操作:
您可以通过以下方式找到 ~/Documents 目录:
将您的“文档”放在 ~/Documents 中也意味着当用户同步其设备时,iTunes 将对其进行备份。
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:
You can find the ~/Documents directory with:
Having your 'document' in ~/Documents also means that it will be backed-up by iTunes when the user synchronizes his or her device.