ios - uiviewcontroller 没有从 ios 中的父类导入

标签 ios inheritance uiviewcontroller

我有以下父类:

//GAViewController.h
@interface GAViewController : UIViewController

@end

//GAViewController.m
#import "GAViewController.h"
#import "GAConfigs.h"

@interface GAViewController ()

@end

@implementation GAViewController

@end

我有以下子类,它像这样实现父类:

// GARegisterLoginViewController.h
#import "GAViewController.h"

@interface GARegisterLoginViewController : GAViewController

@end


//GARegisterLoginViewController.m
#import "GARegisterLoginViewController.h"

@interface GARegisterLoginViewController ()

@end

@implementation GARegisterLoginViewController
// I cannot reference GAConfigs.h in the methods here
@end

我的configs 文件是这样的:

#ifndef GAConfigs_h
#define GAConfigs_h

//Segues
#define LOGINREGISTER_TO_REGISTER_SEGUE @"loginregisterToRegisterSegue"
#define LOGINREGISTER_TO_LOGIN_SEGUE @"loginregisterToLoginSegue"

#endif

问题出在 GARegisterLoginViewController.m 中。我不能在子类中引用 GAConfigs,即使它是在父类中导入的。

有人知道我做错了什么吗?

最佳答案

您正在将文件导入到实现文件 (.m) 中。

如果您将该文件移动到头文件 (.h),它将被正确继承。

关于ios - uiviewcontroller 没有从 ios 中的父类导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24274413/

相关文章:

IOS:将imageview从 ScrollView 拖放到 View 中

Javascript,原型(prototype)不继承

iphone - 如何替换旋转和缩放的 UIImageView 中的图像?

C#继承。从基类派生类

python - OpenERP引擎修改

ios - 找不到导航 Controller 来导航另一个 View Controller

iphone - 强制调用 UIViewController 子类方法

ios - 模态视图 Controller 生命周期?

ios - 如何用 objective-c 类做IS?

ios - 应用程序加载器 : ERROR ITMS-90502