通函#import参考 [英] Circular #import Reference

查看:62
本文介绍了通函#import参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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屋!

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