标题: #import 与 #include的区别 [打印本页] 作者: 后街男孩 时间: 2015-7-20 12:49 标题: #import 与 #include的区别 1.#import 与 #include的区别
#import
In the C language, the #include pre-compile directive always causes a file's contents to be inserted into the source at that point. Objective-C has the equivalent #import directive except each file is included only once per compilation unit, obviating(去除) the need for include guards.
for example 三个文件
文件A.h
文件B.h
文件C.h
文件C.h需要引入A.h、B.h ,文件B.h需要引入文件A.h,这样就重复引用了A.h两次,使用#import可以进行优化