Passing variables between .m files
Passing variables between .m files
- Subject: Passing variables between .m files
- From: Aaron Robinson <email@hidden>
- Date: Wed, 9 Sep 2009 14:09:08 -0700
I have been struggling over this one for a while now, and what frustrates me
the most is the feeling that it should be relatively simple to do.
Let's say I have File1.m and File2.m, and I would like to access a variable
in File2.m from File1.
My previous programming experience is in Java, so my first impression was to
do this (in the File1 implementation file):
File2.outletVariable = varFile1;
I tried reorganizing it to fit Object C in this manner:
[File2.outletVariable setFloatValue:varFile1];
It would give me the error "syntax error before "." token," which I take to
mean it doesn't support identifying variables in this manner.
I have been through dozens of blogs, tutorials, and sample projects in the
hopes of finding one that did this kind of thing, but I so far I haven't
found blogs or tutorials that go over it, and the sample code that did have
something like it was too difficult for me to understand, since it usually
involved some other process that I wasn't familiar with.
Some of what I read lead me to believe that the answer possibly lies in
created another method and calling it from the other file. I haven't been
able to get this to work for me either, however; the closest I got, it
wouldn't let me pass a float variable through it. And it seemed like that
was more work than necessary to pass variables in this manner.
The reason I can't just put all the variables I want access to in the same
file is because I'm developing an Audio Unit with the Cocoa View, and using
Interface Builder, and the place I can get the variables are in a different
file than the outlets for my textfields and sliders.
I would really appreciate any suggestions. Other than a few little things
like this, I have greatly enjoyed developing via Xcode and Interface
builder.
Best,
Aaron
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden