Accessing variables of another class in xcode

前端 未结 5 411
一向
一向 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:34

    Just import the balloon.h file into your balloonGameViewController

    #import balloon.h
    

    and then access the variables as usual, assuming they are public. Otherwise you have to make them public or create getters and setters.

提交回复
热议问题