Do I have to create some dummy hardcoded array wit

2019-09-04 12:19发布

问题:

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.