【发布时间】:2016-05-31 09:17:13
【问题描述】:
我有以下代码:
var myBundle:NSBundle
myBundle = NSBundle.mainBundle() // what is the role of this line ??
if let path = myBundle.pathForResource("CellDescriptor", ofType: "plist"){
var cellDescriptors: NSMutableArray!
cellDescriptors = NSMutableArray(contentsOfFile: path)
}
为什么我使用这行代码myBundle = NSBundle.mainBundle()?我读到它正在初始化myBundle 对象。但这究竟是什么意思?
为什么不初始化myBundle对象就不能调用pathForResource函数?
谢谢。
【问题讨论】: