Terrel Gibson
Terrel Gibson

Reputation: 481

Accessing results from a method in another Class

Hi I am trying to get the results from a method that is in another class than mine. The method is a class method in CalculatorBrain.m. The problem is the Class method uses a instance variables that the other class graphingView.m doesnt have stored in it. GraphingView only gets called when a button is clicked and is segued to. How do I call this class method without the proper variables to start the method?

This method is stored in calculator brain. I want to access it in graphingView

+ (double)runProgram:(id)program usingVariableValues:(NSDictionary *)variableValues
{
  NSMutableArray *stack;
  if ([program isKindOfClass:[NSArray class]]) {
      stack = [program mutableCopy];
  }

  return [self popOperandOffProgramStack:stack];
}

So far I have this:

[CalculatorBrain runProgram:<#(id)#> usingVariableValues:<#(NSDictionary *)#>

I dont know how to put in the values I had to the instance variables in calculator brain.

Upvotes: 0

Views: 132

Answers (1)

Luke Dubert
Luke Dubert

Reputation: 671

Save the results to a property and then you can access them in another class.

(I'm assuming you're in the same view controller and are accessing both models from it.)

Upvotes: 1

Related Questions