Do I have to create some dummy hardcoded array with data for viewing prefs in table view?

筅森魡賤 提交于 2020-01-06 11:45:33

问题


How to create a UITableViewController that displays some hardcoded data in grouped styled (like iPhone settings). For example I need to show some menu options in a table with group style. Now, I know to work with tables and have done it already. But I'm not sure about how should I deal with data that table view will read for constructing the table. Those rows just present some menu options like "order", "review", "about us" then IMHO I have to create some array with that data and store in NSUserDefaults. Am I right?


回答1:


Create a plist file of your data. It can include arrays of items for each group. Included the plist in your project and read it in for use by your datasource. That creates a nice decoupling of data from UI.



来源:https://stackoverflow.com/questions/7192691/do-i-have-to-create-some-dummy-hardcoded-array-with-data-for-viewing-prefs-in-ta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!