是否有地方可以放置类别导入语句,以便所有类都能看到它? [英] Is there a place to put a category import statement so all classes see it?

查看:175
本文介绍了是否有地方可以放置类别导入语句,以便所有类都能看到它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIColor的Objective-C类别,我想在项目的任何地方导入。但是,不是将#import用于每个需要它的类,我被告知有一种方法可以设置它,所以所有类都可以看到它。有谁知道这是如何实现的?

I have an Objective-C category of UIColor that I would like to "import" everywhere in my project. But instead of using the #import to every class that needs it I was told there was a way to set it up so all classes can see it. Anyone know how this is accomplished?

提前致谢,
Rob

Thanks in advance, Rob

推荐答案

将该导入添加到项目中的预编译头文件(* .pch)中 - 这样它将自动导入到任何实现文件中。

Add that import to the precompiled header file (*.pch) in your project - that way it will be imported to any implementation file automatically.

这篇关于是否有地方可以放置类别导入语句,以便所有类都能看到它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆