仅当从RESideMenu启动时才识别UITableViewCell的重用标识符

时间:2013-07-06 16:01:29

标签: iphone ios uitableview

Here is the link to RESideMenu, what I'm using in my project

简单地说,当我将UITableView作为根视图控制器并启动它时,它可以正常工作。我所有的自定义UITableViewCell都在那里,看起来很棒。问题是,每当我尝试从RESideMenu启动UITableView时。当我这样做时,我收到了这个错误:

2013-07-06 11:49:07.844 halocustoms[4438:c07] *** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], 
/SourceCache/UIKit_Sim/UIKit-2380.17/UITableView.m:4460 2013-07-06 11:49:07.845 projectcf32[4438:c07] 
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier CustomCell -
must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

我已经在我的故事板上检查了我的重用标识符大约一百次,并且它必须有效,因为当应用程序最初启动时一切都很好。就在从RESideMenu中选择UITableViewController时。

注意,这就是RESideMenu显示viewcontroller的方式:

RESideMenuItem *homeItem = [[RESideMenuItem alloc] initWithTitle:@"Quick Games" action:^(RESideMenu *menu, RESideMenuItem *item) {
        [menu hide];

        MyTableView *viewController = [[MyTableView alloc] init];
        viewController.title = item.title;
        UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
        [menu setRootViewController:navigationController];
    }];

非常感谢!

1 个答案:

答案 0 :(得分:0)

MyTableView *viewController = [[MyTableView alloc] init];

应该是:

MyTableView *viewController = (MyTableView *)[self.storyboard instantiateViewControllerWithIdentifier: @"yourIdentifier"];