IOS Development Guide Chapter 12th application settings

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.