Access Variable from Another Class - Objective-C

后端 未结 3 1835
孤独总比滥情好
孤独总比滥情好 2021-01-22 13:15

This question has probably been asked before so I\'m sorry.

I am working on an iPhone app and lets say I have a variable, var, in class1. I want to add a UIButton in cl

3条回答
  •  鱼传尺愫
    2021-01-22 13:57

    Use a setter method -setVar: or similar on the class that you want to set the variable in. You can't access instance variables of other objects: they are all private by default.

提交回复
热议问题