可以通过上面提到的Property List Editor程序编辑一个plist文件。首先我们记住:plist文件内容是由一系列的属性名和对应的值通过一定的顺序组合组成的。
下面只是举一个简单的例子,通过例子大家可以熟悉plist文件的树状结构和支持的数据类型等特性。
运行Property List Editor程序后,看到的是下图的内容,在按钮下面是三列的空表,三列分别是:Peroperty List,
Class, Value. 其中Peroperty List就是属性名称列表;
Class是定义该属性的类型,plist文件支持好多种类型,这一点后面说;Value就是该属性的值。
首先, 我们需要创建一个根,点击New Root按钮, 系统生成一个属性名叫Root, 类型是Dictionary(字典), Value是一个不可编辑的默认是"0 key/value pairs"的一行.
我们用鼠标点击这个Root. 上面的New Root按钮变成了New Sibling,
但是是灰色禁止的,也就是说plist文件只能由一个Root,它没有兄弟。为了能在Root下面添加它的子属性,
在Root左边有一个向右的小三角, 用鼠标点击它,它变成了向下的三角, 也就是告诉程序,这时上面的New Sibling按钮就变成的New
Child了,我要编辑/查看它的子属性。所以对于可以添加子属性的属性,一定要首先打开它才能对它编辑,这是以后要用到的。
先面先来建立一个简单的属性,点击New Child,在走边列给它一个名称,叫Background, 中间列选String, 也就是一个字符串类型,最右面写入该属性的值,比如~/Pictures/Background.jpg.
现在Background是选中的,上面的按钮是“New Sibling”, 点击它, 并给它Childs的属性名,
点击类型列,会出现上图的所支持的所有类型的列表,选择Array的类型,也就是数组类型,大家知道数组是一个相同属性的值组成的一列,每个值按照0,
1, 2...的顺序排列,所以,点击它左面的三角打开它后,每添加一个它的子属性,系统会自动为每个子属性设定一个数字的属性名,
我们分别建立两个子属性,每个都是字符串string类型, 值分别是Son, Daughter.
选定Root, 再建立一个子属性,叫做Country, 属性是Dictionary, 它的子属性有三个, 分别是CA, CN, UN, 数值类型都是数字Number, 值分别是0, 1, 2。
再在Root下面建立一个子属性,叫做MyData, 属性是Data, 内容可以自己填写.
再建立一个Root的子属性,叫做Today, 属性是Date, 程序自动填上当天的日期.
最后建立一个Root的子属性,叫做AmITony, 属性是布尔Boolean,也就是是否, 默认是Yes。
完成上面的工作后,我们得到的是如下图的一个plist文件.
相关推荐
本示例通过 Preferences 创建、删除、更新和查询应用程序偏好数据,主要实现了登录页面偏好数据存取及主页面背景色偏好数据存取。 说明: 启动页面勾选不再显示,保存该偏好数据,下次启动应用不再显示该页面,直接...
.Now uses the Mac OS X LDAP framework rather than compiled OpenLDAP code. It believe that the version is OpenLDAP 2.2.19. Operating System Requirements: This product is designed to run on the ...
Mac OS X配置这些脚本将按照我们想要的方式配置Mac OS X,包括: 配置操作系统首选项安装应用程序配置应用这些脚本是为Mac OS X 10.9(Mavericks)编写的。 这些脚本都应该是幂等的。 (这意味着您可以根据需要运行...
preferences-helper SharePreferences is very popular with any project and all most all project has SharePreferences for saving data. This library will help you faster in configuration and use ...
Rx Preferences Reactive SharedPreferences for Android. Usage Create an RxSharedPreferences instance which wraps a SharedPreferences: SharedPreferences preferences = PreferenceManager....
preferences
android 偏好设置,向用户提供软件参数设置功能
NULL 博文链接:https://eleopard.iteye.com/blog/1756249
Get the concise information you need to start using OS X Mountain Lion, the latest version of the Mac operating system. This handy guide goes right to the heart of the OS, with details on system ...
复杂的首选项 Android - 作者 Felipe Silvestre Complex Preferences 是 android 的一个组件,它允许开发人员将对象和复杂对象放在 SharedPreferences 中。 Gson(Google Json 库)在内部用于持久化对象。 android ...
FastSave is An Android library for fast and easy access to Android Shared preferences. It allows you to save any type or list in the sharedpreferences and retrieve it in convenient way. Installation ...
下载repositories { maven { url " https://jitpack.io " }}dependencies { implementation ' com.github.tfcporciuncula.flow-preferences:flow-preferences:1.4.0 '}看起来如何从常规的SharedPreferences开始: ...
安卓 数据存储 Preferences
Multiplatform Preferences Use a single object : Preferences in your kotlin shared projects Compatible with kotlin android and kotlin native for iphone class MyPresenter { val preferences = ...
android设置一些常用的属性,如ip地址和端口号什么,都是可以用android的Preferences来设置,简单方便。
Tutorial Android Preferences
Apple designed OS X with advanced technologies that work together to constantly keep your Mac safe. Some of these features are turned on by default, whereas others are turned off or aren't dialed up ...
立方体工作室Cubelets Studio 是 Mac OS X 上的编程环境。将您的蓝牙 Cubelet 连接到您的 Mac,为您的机器人构造创建新的高级行为!概述第 1 步:连接使用Apple > System Preferences > Bluetooth配对您的 Bluetooth...
Chapter 1: An Introduction to Java 1 Java As a Programming Platform 2 The Java “White Paper” Buzzwords 2 Java Applets and the Internet 7 A Short History of Java 9 Common Misconceptions about ...
再也不用担心,不小心打开或者关闭了什么功能,而一脸懵逼了