我如何参考UIVIew中的方法?

时间:2011-05-17 15:19:32

标签: iphone objective-c class

我已将我的.h文件导入第二个,但在第二个我正在尝试:

FirstClass *firstClass = [FirstClass alloc] init];
[firstClass iconWithType:test];

要匹配:

-(void)iconWithType:(NSString *)iconType

但它没有将iconWithType列为建议,我收到警告说它可能没有回应。

我怎样才能让它正常工作?

我的FirstClass是一个UIView。

2 个答案:

答案 0 :(得分:2)

在FirstClass.h文件中,您是否在interface

中有方法定义

@interface FirstClass : NSObject {
}

- (void)iconWithType:(NSString *)iconType;

@end

此外,该方法的名称意味着应返回一些内容。但是,它被标记为无效。

答案 1 :(得分:0)

我猜你只是有一个返回类型不匹配。看一看:-iconWithType:实际上会返回void吗?还是会返回UIImage或其他东西?

相关问题