1 overview
The items in the setup do not change frequently in the application, which determines the basic characteristics and behavior of the application.
Configuration is a functional block that is developed within the application and is part of the application, and the project is constantly changing.
2 Application Provisioning Package
The Settings bundle is a package file that contains a description of the desired items in the Setup interface using the localized sub-settings of the photo text and other content. Open through the Finder.
The Root.plist file describes the project information that is set in the root settings interface.
The En.lproj folder and the Root.strings file are localization-related and used to set the interface information.
Created: Ios-resource-settings Bundle
3 Setting Item Types
Xcode identifier-----Notepad key to remove the decoy: Right-click-show Raw keys/values
1) Text field
Type-pstextfieldspecifier Title-name
2) switch
Type-pstoggleswitchspecifier title of the Title-project
3) Sliding block
Type-pssliderspecifier
Add a maximum picture and a minimum picture to the Settings item: Copy the picture to the app package, in PNG format.
4) List of values
Provide a list of multiple choices for the user
Type-psmultivaluespecifier title-Item Title titles string array-option caption values-option value
5) Sub-interface
You can navigate to the next level Setup interface
Type-pschildpanespecifier file-Setting the. plist file name for the sub-interface
4 Read settings
Nsuserdefaults *deaults=[nsuserdefaults Standarduserdefaults];
Value method: Xxxforkey: Remove XXX value by key
-(Ibaction) GetData: (ID) Sender {nsuserdefaults* Defaults =[Nsuserdefaults Standarduserdefaults]; Self.username.text= [Defaults Stringforkey:@"name_preference"]; Self.password.text= [Defaults Stringforkey:@"password_preference"]; if([Defaults Boolforkey:@"enabled_preference"]) {Self.clearCache.text=@"YES"; } Else{Self.clearCache.text=@"NO"; } Self.flowmeter.text= [NSString stringWithFormat:@"%.2FGB", [Defaults Doubleforkey:@"slider_preference"]]; Self.serverName.text= [Defaults Stringforkey:@"multivaule_preference"]; if([Defaults Boolforkey:@"sound_enabled_preference"]) {Self.notiSound.text=@"YES"; } Else{Self.notiSound.text=@"NO"; } if([Defaults Boolforkey:@"vibrate_enabled_preference"]) {Self.notiVibrate.text=@"YES"; } Else{Self.notiVibrate.text=@"NO"; }}
IOS Development Guide Chapter 12th application settings