在我的应用程序中添加设置页面(Xcode和Swift)

时间:2023-01-13 21:00:19

I want to add a settings page within my app. I have seen that there is a way to have a settings page (settings bundle) inside the native Settings app (like here: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/UserDefaults/Preferences/Preferences.html). But I want to have the settings for my app, within my app.

我想在我的应用中添加设置页面。我已经看到有一种方法可以在本机设置应用程序中设置设置页面(设置包)(例如:https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/UserDefaults/Preferences/ Preferences.html)。但我想在我的应用程序中为我的应用程序设置。

I could do a couple of things, but I don't know which is the right approach... I could use the InAppSettingsKit (http://www.inappsettingskit.com/) or do everything manually which would be very messy(I think?) What have you guys/girls done with your settings in the past, and what do you think would be the best approach to this? And is there a better approach to this problem, than what I have listed above?

我可以做几件事,但我不知道哪种方法是正确的...我可以使用InAppSettingsKit(http://www.inappsettingskit.com/)或手动完成所有操作都非常混乱(我想想?)你们/女孩过去对你的设置做了什么,你认为最好的方法是什么?对于这个问题,有没有比我上面列出的更好的方法?

Thanks so much :)

非常感谢 :)

1 个解决方案

#1


7  

Depending the number of parameters you need in your settings, the approach could be different.

根据您在设置中需要的参数数量,方法可能会有所不同。

  • If you have a lot of parameters, with the need of rows containing sliders, switches or whatever advanced cell configuration, then using a library such as InAppSettingsKit is a good bet.

    如果你有很多参数,需要包含滑块,开关或任何高级单元配置的行,那么使用像InAppSettingsKit这样的库是一个不错的选择。

  • On the other hand, if you have only a few parameters, using UITableViewController with Static Cells and Grouped Style could be sufficient. You can do a lot of things in Interface Builder and perform actions in code.

    另一方面,如果您只有几个参数,使用带静态单元格和分组样式的UITableViewController就足够了。您可以在Interface Builder中执行很多操作并在代码中执行操作。

Choose the approach you're most comfortable with, I think both are respectable.

选择你最熟悉的方法,我认为两者都是可敬的。

#1


7  

Depending the number of parameters you need in your settings, the approach could be different.

根据您在设置中需要的参数数量,方法可能会有所不同。

  • If you have a lot of parameters, with the need of rows containing sliders, switches or whatever advanced cell configuration, then using a library such as InAppSettingsKit is a good bet.

    如果你有很多参数,需要包含滑块,开关或任何高级单元配置的行,那么使用像InAppSettingsKit这样的库是一个不错的选择。

  • On the other hand, if you have only a few parameters, using UITableViewController with Static Cells and Grouped Style could be sufficient. You can do a lot of things in Interface Builder and perform actions in code.

    另一方面,如果您只有几个参数,使用带静态单元格和分组样式的UITableViewController就足够了。您可以在Interface Builder中执行很多操作并在代码中执行操作。

Choose the approach you're most comfortable with, I think both are respectable.

选择你最熟悉的方法,我认为两者都是可敬的。