Alo*_*lok 8 filepath nsbundle ios swift
我想从swift中获取Path的NSBundle引用.
就像在Objective-c>中一样
NSBundle* languageBundle = [NSBundle bundleWithPath:path];
Run Code Online (Sandbox Code Playgroud)
我们如何在迅速实现同样的目标.
Avi*_*are 10
试试这个
var path = NSBundle.mainBundle()//path until your project name.app
var pathForFile = NSBundle.mainBundle().pathForResource("Filename", ofType: "db")// path of your file in bundle
Run Code Online (Sandbox Code Playgroud)
斯威夫特4:
var pathForFile = Bundle.main.path(forResource: "Filename", ofType: "db")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12859 次 |
| 最近记录: |