0

我正在使用以下代码创建一个静态方法来返回 DashboardMainMenuViewController。在接口 .h 文件中,我收到一条错误消息,指出期望类型。

+(DashboardMainMenuViewController *) dashboardMainMenuController;

+(DashboardMainMenuViewController *) dashboardMainMenuController
{
    UISplitViewController *splitViewController = (UISplitViewController *) [[[self appDelegate] window] rootViewController];

    NSArray *navigationControllers = [splitViewController viewControllers];

    NSArray *viewControllers = [[navigationControllers objectAtIndex:0] viewControllers];

    return (DashboardMainMenuViewController *) [viewControllers objectAtIndex:0];
}
4

1 回答 1

2

要么 要么#import "DashboardMainMenuViewController.h"用 声明对它的前向引用@class DashboardMainMenuViewController。编译器只知道导入头文件中定义的类型或前向声明的类型

于 2013-02-20T20:32:46.147 回答