1.创建一个静态库工程

2.创建三个类静态库测试类 两个类分别在两个子文件夹下

3.创建一个新的iOS应用工程 将刚才创建的静态库工程引入到新工程中(右击工程 add file to "TestDemo")

(注意 如果选择了copy 在新工程中对 库文件修改将不会影响到库文件 如果没有选择 在TsetDemo工程中修改 将会影响 TestLibrary工程 根据需求来定)
-
在项目工程中添加入静态库的引用
tagert -> build Phases -> link Binary With Libraries
7648F54B-15C1-4F2F-971A-EA5546FF1997.png

5.加入静态库的搜索目录
tagert -> build setting -> Header search path

找到刚才静态库的目录 拖入到header search path 中

- 添加静态库编译头头文件


7.测试

(8. 如果library中没有同名文件,可以在library中创建一个文件夹包换所有的编译头文件作为搜索目录 测试的时候引入头文件就不需要使用文件夹区分了)
网友评论