zoukankan      html  css  js  c++  java
  • ios bundle

    第一种:把资源文件整合到.bundle里面统一管理

    1 创建一个文件夹 MyBundle

    2.把资源文件放进去

    3.然后重命名 MyBundle.bundle

    4.添加到project里面

    5.读取MyBundle.bundle 里面的test.sqlite文件,如果不指定inDirectory,path为nil

    NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"sqlite" inDirectory:@"MyBundle.bundle"];

    第二种:直接在project里面创建一个group "Data"

    1.添加test.sqlite文件到Data group里面

    2.读取,不需要指定inDirectory

    NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"sqlite"];

     /Users/zhanglei/Library/Developer/CoreSimulator/Devices/C8423A4F-BD2C-4995-A9E4-77BB382F3DF8/data/Containers/Bundle/Application/B3E6D1E8-FE8E-428B-BA61-53308C920CAB/sqlite.app/Data.bundle/test.sqlite

  • 相关阅读:
    刚好遇见你——软件工程
    int main(int argc,char* argv[]) 简单理解
    奇偶数分离
    A+B Problem
    日期计算
    正三角形的外接圆面积
    数数小木块
    谁是最好的Coder
    水仙花数
    5个数求最值
  • 原文地址:https://www.cnblogs.com/zhangleixy/p/5045627.html
Copyright © 2011-2022 走看看