简体   繁体   中英

Objective-C - Calling Methods in objects.

I'm new to Objective-C, and I seem to be struggling with accessing a method of an object I created. I'm checking out the documentation, but I'm not entirely sure that this is a job for a delegate.

For example I have an object (1) that creates another object (2). I can access a method of the object (2) after I create it, but I can't access it from a method of object (1). I get a error that the object was not defined in this scope.

If anyone can help I greatly appreciate it. I just need a nudge in the right direction so that I can at least get a grasp on how to think about the interaction between the objects.

Turns out I did not define the object in @interface. This caused my methods to not have access to it. So for anyone with a similar issue, make sure to define your i-vars in the interface and not init :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM