在iOS7下 使用@import代替#import
来源:互联网 发布:网站搜索引擎优化案例 编辑:程序博客网 时间:2024/05/22 08:27
原文链接:http://www.th7.cn/Program/IOS/201404/188338.shtml
在xcode 5 下,为了更易于开发,增加了modules和 auto-linking 这两个新特性。用 @import 来增加框架 到项目中比用 #import会更有效. 我们来看看为什么:
"Modules for system frameworks speed build time and provide an alternate means to import APIs from the SDK instead of using the C preprocessor. Modules provide many of the build-time improvements of precompiled headers with less maintenance or need for optimization. They are designed for easy adoption with little or no source changes. Beyond build-time improvements, modules provide a cleaner API model that enables many great features in the tools, such as Auto Linking."
Modules and auto-linking 默认情况下是enabled的。 如果是旧的项目,你可以通过设置"Language - Modules." 来设置Enable Modules 和Link Frameworks Automatically 为Yes。
另外一个使用moudules的好处是你再也不用去链接你的framework到你的项目了。例如,在以前,如果你要使用MapKit这个框架,你要这样做1) 使用语句 #import <MapKit/MapKit.h> 导入框架2) 去到项目的build phases 设置项,找到MapKit.framework.并加入到Link Binary With Libraries里面。如果使用modules的话,只需要加入语句 "@import MapKit;" 你就可以开始使用了,根本不需要链接到你的项目。- 在iOS7下 使用@import代替#import
- 在ios 7下,使用@import代替#import
- 在使用import语句时
- @import使用
- import
- import
- import
- import
- import
- import
- #import
- import
- #import
- #import
- @import
- Import
- import
- import
- 屏幕自动适应
- asp,IIS,权限
- R in Action 学习笔记 - 第九章-常用R函数
- Appium总结(一):安装
- Oracle数据库基础(三)--查询
- 在iOS7下 使用@import代替#import
- Python 中的进程、线程、协程、同步、异步、回调
- Xcode中常用的快捷键操作
- 软件测试面试
- GCD之串行队列与并发队列
- java初学者 歌手打分实例练习
- 2015年去哪儿网Qunar面试题
- [learn ros]尝试修改task_setup.py
- Struts2通过json前后自动给后台自定义对象赋值