iphone - View Controller 继承。找不到接口(interface)

标签 iphone objective-c ios cocoa-touch uiviewcontroller

我有一个基础 View Controller :

@interface NEViewControllerWithSidebarMenu : UIViewController <UITableViewDataSource, UITableViewDelegate>
{
    UIView *viewWithContent;
    UIView *sidebarView;
    UITableView *sidebarTableView;
}

@property (nonatomic, retain) UIView *viewWithContent;
@property (nonatomic, retain) UIView *sidebarView;
@property (nonatomic, retain) UITableView *sidebarTableView;

-(void)menuButtonPressed:(id)sender;
-(void)loadSidebar;

@end

及其实现:

#import "NEViewControllerWithSidebarMenu.h"

@interface NEViewControllerWithSidebarMenu ()

@end

@implementation NEViewControllerWithSidebarMenu

@synthesize sidebarView, sidebarTableView;
@synthesize viewWithContent;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Actions

-(void)menuButtonPressed:(id)sender
{
    ... do some things here
}


-(void)loadSidebar
{
    .....        
    UIButton *menuButton=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    [menuButton setFrame:CGRectMake(0.0, 0.0, 80, 40)];
    [menuButton setTitle:@"Меню" forState:UIControlStateNormal];
    [menuButton addTarget:self action:@selector(menuButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *menuBarButtonItem=[[UIBarButtonItem alloc] initWithCustomView:menuButton];
    self.navigationItem.leftBarButtonItem=menuBarButtonItem;
    .....

}

-(void)changeToViewController:(UIViewController *)viewController
{
    UINavigationController *navController = self.navigationController;
    [navController popViewControllerAnimated:NO];
    [navController pushViewController:viewController animated:NO];
}

-(void)popViewControllerAnimated
{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)pushViewControllerAnimated:(UIViewController *)viewController
{
    [self.navigationController pushViewController:viewController animated:YES];
}

#pragma mark - UITableViewDataSourse

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    switch (section)
    {
        case 0:
        {
            return 6;
            break;
        }
        default:
        {
            NSLog(@"PANIC: unknown section index");
            return 13;
            break;
        }
    };
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    ......
}

#pragma mark - UITableViewDelegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    .......
}

@end

现在我声明了一个继承自 NEViewControllerWithSidebarMenu 的 Controller ,我得到了错误:

@interface NECompanyRootViewController : NEViewControllerWithSidebarMenu
{
    //
}

@end

找不到“NEViewControllerWithSidebarMenu”的接口(interface)声明,“NECompanyRootViewController”的父类(super class)

请帮帮我。为什么会出现此错误以及如何解决?

最佳答案

先导入Header

#import "NEViewControllerWithSidebarMenu.h" 
@interface NECompanyRootViewController : NEViewControllerWithSidebarMenu
{
    //
}

@end

关于iphone - View Controller 继承。找不到接口(interface),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13192678/

相关文章:

ios - 在 UIImageView 中从黑色淡出图像?

iphone - UIDocumentInteractionController 自 iOS6 起不起作用

iphone - iPhone 上 TableView 重用单元格的问题

ios - Xcode 6.1 中的 StoryBoard 问题

iphone - GPUImage 使用 UISlider 改变亮度

ios - 亚马逊 AWS SNS : How do i subscribe to SNS topic from iOS?

objective-c - Objective C 中的消息与 C# 和 Java 中的简单方法调用相比有何不同?

php - 如何在 Laravel 上获取 iPhone 的联系人

ios - 如何在没有 WiFI 和服务器的情况下以编程方式将多个 iOS 设备联网,只使用蓝牙?

ios - 如何使用 iOS 音效管理音量?