gpt4 book ai didi

objective-c - 类未被读取...未知类型名称

转载 作者:可可西里 更新时间:2023-11-01 05:14:49 25 4
gpt4 key购买 nike

我不确定发生了什么或我改变了什么,但突然间我试图引用一个类“在项目树中”和文件夹中(当我“在取景器中显示”时)根本没有被阅读...我在同一行代码上遇到多个错误 [见附件]。

enter image description here

请帮忙!!!


当我尝试将 HomeViewController.h 导入我的 MainContainerViewController 时出现问题

作品:

#import <UIKit/UIKit.h>
#import "ViewController.h"

@interface MainContainerViewController : UIViewController {

ViewController *parent;

NSString *FACING;
IBOutlet UIView *container;

IBOutlet UIView *topNav;

IBOutlet UIButton *homeBTN;
IBOutlet UIImageView *homeImg;
IBOutlet UILabel *homeLabel;
IBOutlet UIImageView *seperator1;
IBOutlet UIButton *bookmarksBTN;
IBOutlet UIImageView *bookmarksImg;
IBOutlet UILabel *bookmarksLabel;
IBOutlet UIImageView *seperator2;
IBOutlet UIButton *favouritesBTN;
IBOutlet UIImageView *favouritesImg;
IBOutlet UILabel *favouritesLabel;
IBOutlet UIImageView *seperator3;
IBOutlet UIButton *notesBTN;
IBOutlet UIImageView *notesImg;
IBOutlet UILabel *notesLabel;
IBOutlet UIImageView *seperator4;
IBOutlet UIButton *fontBTN;
IBOutlet UIImageView *fontImg;
IBOutlet UILabel *fontLabel;
IBOutlet UIImageView *seperator5;
IBOutlet UIButton *settingsBTN;
IBOutlet UIImageView *settingsImg;
IBOutlet UILabel *settingsLabel;

NSString *drawerIsAnimating;

//SETTINGS (LOCAL)
NSString *fontSize;

等等

损坏:

#import <UIKit/UIKit.h>
#import "ViewController.h"
#import "HomeViewController.h"

@interface MainContainerViewController : UIViewController {

ViewController *parent;

NSString *FACING;
IBOutlet UIView *container;

IBOutlet UIView *topNav;

IBOutlet UIButton *homeBTN;
IBOutlet UIImageView *homeImg;
IBOutlet UILabel *homeLabel;
IBOutlet UIImageView *seperator1;
IBOutlet UIButton *bookmarksBTN;
IBOutlet UIImageView *bookmarksImg;
IBOutlet UILabel *bookmarksLabel;
IBOutlet UIImageView *seperator2;
IBOutlet UIButton *favouritesBTN;
IBOutlet UIImageView *favouritesImg;
IBOutlet UILabel *favouritesLabel;
IBOutlet UIImageView *seperator3;
IBOutlet UIButton *notesBTN;
IBOutlet UIImageView *notesImg;
IBOutlet UILabel *notesLabel;
IBOutlet UIImageView *seperator4;
IBOutlet UIButton *fontBTN;
IBOutlet UIImageView *fontImg;
IBOutlet UILabel *fontLabel;
IBOutlet UIImageView *seperator5;
IBOutlet UIButton *settingsBTN;
IBOutlet UIImageView *settingsImg;
IBOutlet UILabel *settingsLabel;

NSString *drawerIsAnimating;

//SETTINGS (LOCAL)
NSString *fontSize;

等等

最佳答案

您可能有一个标题导入周期。

添加

@class MainContainerViewController2;

就在

@interface HomeViewController2

它应该可以解决该特定问题。

根据经验,如果不是绝对需要,则不应在 header 中#import header ,即。父类(super class)标题。如果你需要使用一个类,用@class声明它而不是导入类头。这样做,您在 99% 的时间里应该是安全的。

关于objective-c - 类未被读取...未知类型名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11163581/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com