Panda Pig • Patty original or translated works. Welcome reprint, Reprint please indicate the source.
If you feel that the writing is not good please more advice, if you feel good please support a lot of praise. Thank you! Hopy;)
Disclaimer: All translations provided by this blog are from the Internet and are for learning and communication purposes only. Also, do not remove this statement when reproduced.
In case of any dispute, there is no relationship between the blogger and the person who published the translation. Thank you for your cooperation!
As in Cocos2d 3.1, if you do not call super in overloading these lifetime methods, the compiler warns you-this can save us a lot of debugging time.
How can you be curious about how this is done?
Cocos2d uses a very good compiler feature diagram to implement this requirement.
You simply add a corresponding __attribute__ keyword to the definition of the method:
-(void) onEnter __attribute__((objc_requires_super));
Method of overloading Cocos2d lifetime