DashboardMainMenuViewController

DashboardMainMenuViewController

我正在使用以下代码创建一个静态方法以返回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];
}

最佳答案

#import "DashboardMainMenuViewController.h"或使用@class DashboardMainMenuViewController声明对其的前向引用。编译器仅知道导入的标头中定义的类型或向前声明的类型

关于ios - 获取期望类型的解析错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14989317/

10-13 09:22