How to add button to settings.bundle?

后端 未结 3 1598
隐瞒了意图╮
隐瞒了意图╮ 2021-01-03 04:19

I\'m developing an iPhone app, and by default user keeps logged in. If he wants to logout, he should open the Settings and click a \"Logout\" button which would erase his da

相关标签:
3条回答
  • 2021-01-03 04:38

    If you don't mind using the 3rd-party add-on "InAppSettingsKit" for your app's Settings, then it looks they would allow you to do what you need. I'm currently studying up on this myself, but from a quick scan through their documentation it looks like they would allow you to add buttons as well as completely custom child pane views: http://www.inappsettingskit.com/

    On that page, study the sections "IASKButtonSpecifier" and "Custom Viewcontrollers".

    I'll post a follow up here to let you know how this worked out for me. I'm using the InAppSettingsKit already, and love it so far.

    Download the code and sample app from Github: https://github.com/futuretap/InAppSettingsKit

    Then open the InAppSettingsKit.xcworkspace in your XCode and study how they implemented the various different types of Settings entries. They definitely support what you are looking for. It's really quite impressive.

    Erik

    0 讨论(0)
  • 2021-01-03 04:47

    As CodaFi said it is not possible. However it could be a good workaround to use a toggle switch for "keep me logged in". And when the user turn it off you can show the login screen on next launch.

    0 讨论(0)
  • 2021-01-03 04:47

    Unfortunately, this is not possible using public APIs. Bear in mind that Apple reserves many, many undocumented (and exceedingly cool) features for it and it's partner's applications. You are limited to only the following:

    Text field: The text field type displays a title (optional) and an editable text field. You can use this type for preferences that require the user to specify a custom string value. The key for this type is PSTextFieldSpecifier.

    Title: The title type displays a read-only string value. You can use this type to display read-only preference values. (If the preference contains cryptic or nonintuitive values, this type lets you map the possible values to custom strings.) The key for this type is PSTitleValueSpecifier.

    Toggle switch: The toggle switch type displays an ON/OFF toggle button. You can use this type to configure a preference that can have only one of two values. Although you typically use this type to represent preferences containing Boolean values, you can also use it with preferences containing non-Boolean values. The key for this type is PSToggleSwitchSpecifier.

    Slider: The slider type displays a slider control. You can use this type for a preference that represents a range of values. The value for this type is a real number whose minimum and maximum value you specify. The key for this type is PSSliderSpecifier.

    Multivalue: The multivalue type lets the user select one value from a list of values. You can use this type for a preference that supports a set of mutually exclusive values. The values can be of any type. The key for this type is PSMultiValueSpecifier.

    Group: The group type is for organizing groups of preferences on a single page. The group type does not represent a configurable preference. It simply contains a title string that is displayed immediately before one or more configurable preferences. The key for this type is PSGroupSpecifier.

    Child: pane The child pane type lets the user navigate to a new page of preferences. You use this type to implement hierarchical preferences. For more information on how you configure and use this preference type, see “Hierarchical Preferences.” The key for this type is PSChildPaneSpecifier.

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