通函#import参考 [英] Circular #import Reference
问题描述
我有一个Xcode项目,必须将数据从我的SettingsViewController
传输到我的ViewController
,问题是我必须在我的ViewController
中实现我的SettingsViewController.h
,因为它被推出了-但是要将数据从SettingsViewController
发送到ViewController
,我也必须在SettingsViewcontroller
中实现ViewController,这也就是在程序被卡住时-不可能有循环的#import
引用,不是吗?>
I have a Xcode project where I have to transfer Data from my SettingsViewController
to my ViewController
, the Problem is that I have to implement my SettingsViewController.h
in my ViewController
, because it gets pushed out of that - but to send data from the SettingsViewController
to ViewController
I have to implement the ViewController in SettingsViewcontroller
too thats when the Program gets stuck - it's not possible having a circular #import
reference, isn´t it?
推荐答案
然后在所有.h文件中使用前向声明,然后将文件导入.m文件中
Use forward declaration in all the .h files then and import the files in .m files
检查此问题 Objective-C:转发类声明
前向声明如下:
@class SettingsViewController;
这篇关于通函#import参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!