【问题标题】:Adding Variable in plist string在 plist 字符串中添加变量
【发布时间】:2016-01-27 18:31:43
【问题描述】:

我想在 plist 字符串中添加一个变量。有可能这样做吗?

例如在数组的第 0 项中。字符串是“今天是 XXXXX” 在我的 swift 文件中,我能够加载 plist 和字符串。但是我怎样才能将我的变量插入到那个 plist 字符串中呢?我应该如何输入我的 plist 以及在我的 swift 文件中编码什么?

谢谢

【问题讨论】:

标签: ios swift variables plist


【解决方案1】:
var myDict: NSDictionary?
if let path = NSBundle.mainBundle().pathForResource("Config", ofType: "plist") {
    myDict = NSDictionary(contentsOfFile: path)
}
if let dict = myDict {
    // Use your dict here
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-15
    • 2023-03-28
    • 1970-01-01
    • 2017-09-09
    • 1970-01-01
    • 1970-01-01
    • 2012-02-23
    • 2015-01-23
    相关资源
    最近更新 更多