我有一组这样的方法:
- (void)resumeGame;
- (void)resumeGameWithOverlay;
- (void)resumeGameOnLeavingBackground:(NSNotification *)notification;
- (void)pauseGame;
- (void)pauseGameOnEnteringBackground:(NSNotification *)notification;
- (void)endGame;
我想做的是能够将它们放入一个单独的文件中,这样这些方法(也需要访问 MVC 的实例变量)只能编写一次,但可以在我拥有的每种不同类型的游戏中使用,即马拉松模式,计时赛。
我的第一个想法是将它们简单地添加到另一个类中,但后来我发现了Categories
. 你会推荐哪一个?