开发者

iphone, calling a method of different class in cocos2d layers?

开发者 https://www.devze.com 2023-03-14 22:47 出处:网络
I have two classes, both are subclasses of CCLayer, I want to call a meth开发者_如何学Good of first class into second class, what should I code?Your question is not providing much detail, but from my

I have two classes, both are subclasses of CCLayer, I want to call a meth开发者_如何学Good of first class into second class, what should I code?


Your question is not providing much detail, but from my understanding of what you say, you need the following:

  1. a selector in the public interface of your first class;

  2. a pointer ivar in the second class that you will properly initialize so that it points to an instance of the first class;

In this way you will be able to call the first class' method from the second class.

0

精彩评论

暂无评论...
验证码 换一张
取 消