开发者

Call a function inside view controller from his super

I am sorry if i am not accurate in my terms. i will be glad if someone can fix me.

I have a ViewController "GeneralCard".

Based on the "GeneralCard" i have created a sibling ViewController called "BlueCard" like that:

开发者_如何转开发@interface BlueCardViewController : GeneralViewController

(I did off course because i have many cards types that all inherits same properties from the "GeneralCard").

It works great but now i am trying something new -

all the cards have a UIGestureRecognizer that shoots function that changes the card content. I want to try to move the UIGestureRecognizer to the "GeneralCard" but to make the gesture call a function that located in the specific card (BlueCardViewController etc). since the function is different in each card.

Is that possible? And what are the correct terms for the object in this situation ?


If you call [self someMethod] it will work its way up from the lowest level class (the one that init was called on) to find the method. So, as long as you have implemented someMethod in the BlueCardViewController class it will be the one called.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜