Reputation: 13247
I have an a property declared in .h
as
@property (nonatomic, assign) int timeSig_Numerator;
and an instance variable declared in the .h
as
int mTimeSig_Numerator;
in the .m
I synthesize with
@synthesize timeSig_Numerator = mTimeSig_Numerator;
I have a C function declared before the synthesize and need to use mTimeSig_Numerator. what is the best way to make the instance variable visible to my C function without passing it in as a function argument?
Upvotes: 2
Views: 515
Reputation:
Since mTimeSig_Numerator
is an instance variable, each instance of your class has its own mTimeSig_Numerator
. As a C function is decoupled from any given class/class instance, how would it know from which instance it should obtain mTimeSig_Numerator
?
Your C function needs either an argument containing the value of mTimeSig_Numerator
in a specific instance, or an argument pointing to the instance itself, or some other mechanism that tells the function which specific instance/instance variable it should use.
Upvotes: 4