找不到类方法返回类型默认为'id'

时间:2012-04-28 12:31:23

标签: objective-c xcode

我收到以下错误:

class method '+view' not found return type defaults to 'id'

使用此代码:

[window addSubview:[ButtonsViewController view]];

有人可以帮忙吗?

这是完整的代码:

    #import "openURLAppDelegate.h"
#import "ButtonsViewController.h"
#include "ButtonsViewController.h"




@implementation openURLAppDelegate


@synthesize window;
@synthesize ButtonsViewController;

- (void)applicationDidFinishLaunching:(UIApplication *)application {



[window addSubview:[ButtonsViewController view]];
[window makeKeyAndVisible];
}


- (void)dealloc {
[ButtonsViewController release];
[window release];
[super dealloc];
}


@end

1 个答案:

答案 0 :(得分:3)

如果view是控制器的UIView,你应该在控制器的实例上调用它,而不是在类上。