Objective-c, how to access an instance variable from another class

后端 未结 4 1680
耶瑟儿~
耶瑟儿~ 2020-12-28 23:13

I am used to programming in Java and to use class variables to access data from other classes. Then I found out that class variables does not work the same way in Obj-C, and

4条回答
  •  隐瞒了意图╮
    2020-12-29 00:10

    Generally,

    When you accept the password in one screen and do whatever with it, you still have it. When you are moving to someother screen why dont you keep, class1's object as a property in class2 and set it before u pass the control to class 2.

    Or if you are just calling the method of class2 ust pass class1 obj as a parameter with password already in it.

    and in case u just pass it to the method as a parameter, u can access it. Or if you are setting it as a property of this class2. then u can always use a getter.

    This thing has got nothing t do with Java or Objective C.

提交回复
热议问题