How can I access variables from another class?

后端 未结 4 1527
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 02:37

There is probably a very simple solution for this but I can\'t get it working.

I have got multiple classes in my Cocoa file. In one of the classes class1

4条回答
  •  生来不讨喜
    2020-12-06 03:19

    You could expose the variable in class2 as a property. If class1 has a reference to class2, class1 can then see the variable. Honestly, though, it sounds like you're a beginner to both Objective-C and object oriented programming. I recommend you read up more on both.

    Here is a place to start for object oriented programming with Objective-C.

提交回复
热议问题