PDA

View Full Version : referencing outlet in another class?




liptonlover
Jan 14, 2009, 06:39 PM
If you helped me with my last problem, this code is related.
I have two classes, one with a method to handle an 'operation', another that will be calling that method. Here's the method,
- (void)sendVariable:(float)variable toOutlet:(id)outlet {
[outlet setText:[NSString stringWithFormat:@"%f", variable]];
}

And here's the reference to it in another class.
[outletController sendVariable:test toOutlet:portalBuildings];
Just so you know, test is a float set to 5 and it's declared in the same class as the above line is called. outletController is an IBOutlet pointing at an instance of the class with the method. I wasn't surprised by the following error, but don't know how to fix it/how to do what I want correctly.
error: 'portalBuildings' undeclared (first use in this function)

Any help would be appreciated.
Thanks, Nate