[Reprinted] iPhone IOS plist File

Source: Internet
Author: User

This is from: http://www.cnblogs.com/geraldzhang/archive/2011/08/24/2152121.html

 

 

 

In the cocoa, nextstep, and gnustep programming frameworks of Mac OS X, A property list file is a file used to store serialized objects. The property list file extension is. PlistTherefore Plist file.

Plist files are usually used to store user settings or bundle information. This function is provided by resource branches in legacy Mac OS.

Using the property list interface in Mac OS and core Foundation, we can convert between hierarchical objects and XML files. We can store the XML file and then read it as an object. Here we will discuss the property list and their forms, and how to use them during programming.

Here I would like to mention nsuserdefault, which is actually stored in the form of property list, but it has limitations. For example, nscolor and nsfont types cannot be directly stored, we must convert them to the nsdata type for storage.ArticleLet's talk about this issue in detail.

Let's get started.

In the programming process, we can create a plist in the project to store some variables. The specific operation steps are file-New-Mac OS X-resource-property list. In the project, we can write data in XML or source code format. For example, the original plistCodeThe format is the same as the XML below.

XML Code
  1. <? XML Version = "1.0" Encoding = UTF-8" ?>
  2. <! Doctype plist public "-// Apple // DTD plist 1.0 // en" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. plist version = " 1.0 " >
  4. <Dict>
  5. < Key > Name </ Key >
  6. < String > John doe </ String >
  7. < Key > Phones </ Key >
  8. <Array>
  9. < String > 408-974-0000 </ String >
  10. < String > 503-333-5555 </ String >
  11. </Array>
  12. dict >
  13. </Plist>

 

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.