0

In my code, i have a class , mainClass , which has an instance method -(void)record . In the interface of mainClass , i have instance variable,which used by this method.

Now, i know that every time i am creating a new instance of the class with :

mainClass *instance=[mainClass alloc]; 

its creating a new place in memory to all this class variables , and now if i do

[instance record]; 

it will create all the variables that are in record but they will be new once.

Now lets say i want to call from an outside class to record , and change/use its variables not create new once, but use the once already created in the mainClass.

whats the best way of doing this, and what it has to do with a class method ? Should this method be a class method? if yes , why ?

1 Answer 1

1

If you want it accessible, instance and permanent changed you have to make it static, will answer your next question

Objective C Static Class Level variables

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.