0

I've got a base 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

and it's implementation:

#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

Now I'm declaring a controller that inherits from NEViewControllerWithSidebarMenu I get error:

@interface NECompanyRootViewController : NEViewControllerWithSidebarMenu
{
    //
}

@end

can not find interface declaration for 'NEViewControllerWithSidebarMenu', superclass of 'NECompanyRootViewController

Help me please. Why I get this error and how can I solve it?

4

1 回答 1

2

先导入Header

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

@end
于 2012-11-02T09:41:13.383 回答