iPhone Global Variable?

后端 未结 3 431
醉梦人生
醉梦人生 2020-12-10 00:30

I have two views with their own .h and .m files of course. How can I declare a bool (or any variable for that matter) in one view and be bale to access it in another view?

3条回答
  •  没有蜡笔的小新
    2020-12-10 00:42

    You can just take a reference to the view containing the bool and get the variable using a getter.

    If you want app wide variables, you could put them in the AppDelegate, but I highly recommend against that since it tightly couples classes.

提交回复
热议问题