Accessing variables of another class in xcode

前端 未结 5 412
一向
一向 2021-01-24 11:52

I have a balloonGameViewController.h and another class I made called balloon.h

I want to access some variables I set in balloon.h

5条回答
  •  广开言路
    2021-01-24 12:37

    As others said, you'll have to #import baloon.h. But you did not say if these variables are global variables or ivars of a class. If they are ivars, you'll first have to find the instance of the class (the object) of which they are ivars. If you have that, and they are public or properties, you can access them as members of that object.

    IOW, it is hard to tell if you don't tell us what kind of variables in balloon.h you want to access. But, see above.

提交回复
热议问题