开发者

How do i refer to methods inside a UIVIiw?

开发者 https://www.devze.com 2023-03-06 07:34 出处:网络
I have imported my .h file into a 2nd one, but in the 2nd one i\'m trying to do: FirstClass *firstClass = [FirstClass alloc] init];

I have imported my .h file into a 2nd one, but in the 2nd one i'm trying to do:

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

To match this:

-(void)iconWithType:(NSString *)iconType

But it's not listing iconWithType as a 开发者_开发技巧suggestion and i get a warning saying it might not respond to that.

How can i get this to work properly?

My FirstClass is a UIView.


In your FirstClass.h file do you have the method definition in the interface?

I.e.

@interface FirstClass : NSObject {
}

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

@end

Additionally, the name of the method implies something should be returned. However, it is marked as void.


I'm guessing you just have a return type mismatch. Take a look: does -iconWithType: actually return void? or does it return a UIImage or something else besides?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号