What's an easy way to set up object communication in Obj-C?

Posted by seaworthy on Stack Overflow See other posts from Stack Overflow or by seaworthy
Published on 2010-04-20T04:28:44Z Indexed on 2010/04/20 4:33 UTC
Read the original article Hit count: 297

I am trying to send a slider value from a controller object to a method of a model object. The later is implemented in the separate file and I have appropriate headers. I think the problem is that I am not sure how to instantiate the receiver in order to produce a working method for the controller.

Here is the controller's method.

-(IBAction)setValue:(id)slider {[Model setValue:[slider floatValue]];}

@implementation Model
-(void)setValue:(float)n{
    printf("%f",n);
}
@end

What I get is 'Model' may not respond to '+setValue' warning and no output in my console.

Any insight is appreciated.

© Stack Overflow or respective owner

Related posts about methods

Related posts about objective-c