Creating iOS-like settings screen

前端 未结 3 1390
迷失自我
迷失自我 2021-02-02 09:25

I have been researching how I can create a settings screen for my app that looks identical to the iOS settings app however I haven\'t been able to find an iOS 7/8/Swift version.

相关标签:
3条回答
  • 2021-02-02 10:16

    Like 'Epic Byte' stated above, going with a UITableViewController with grouped style is an approach that ended up working for me. That tip put me down the right path.

    Here are some links that helped me get the job done (in my case I also needed this to appear in a tab bar controller):

    • http://useyourloaf.com/blog/static-table-views-with-storyboards.html
    • http://www.appcoda.com/storyboard-tutorial-create-tab-bar-controller-and-web-view/
    • http://shrikar.com/xcode-6-tutorial-grouped-uitableview/

    Note that even though the screenshots appear to be for iOS versions < 8, the mechanics in the storyboard view carry over.

    0 讨论(0)
  • 2021-02-02 10:16

    Despite the question saying "obviously this won't work now," the project mentioned in that linked blog post, InAppSettingsKit, does still work great and is actively being maintained/updated in 2020.

    InAppSettingsKit provides an in-app Settings display that looks and works like the iOS native Settings app. It automatically presents settings from your app's same Settings.bundle resource that the Settings app itself uses. See the linked GitHub project for full details.

    0 讨论(0)
  • 2021-02-02 10:22

    The above answer is correct, but I wanted to add the solution itself here to save time for future users.
    In order to make a regular UITableView look like the "Settings" page, you only need to to two things:
    1. implement tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int and tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? so that the table will have multiple sections with headers.
    2. set the table style to .grouped, which can be done via the storyboard editor.

    0 讨论(0)
提交回复
热议问题