This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Chunk

By: a guest on Jun 17th, 2013  |  syntax: Objective C  |  size: 0.79 KB  |  views: 38  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. @class Chunk;
  2.  
  3. @protocol ChunkDelegate
  4. @required
  5. - (CGFloat)heightForChunk:(Chunk *)chunk;
  6. @end
  7.  
  8. @interface ChunkController ()<ChunkDelegate>
  9.  
  10. @property (nonatomic, strong) Game *game;
  11.  
  12. @end
  13.  
  14. @implementation ChunkController
  15.  
  16. - (void)createChunks;
  17. {
  18.   // create chunks here
  19.   Chunk *chunk = [[Chunk alloc] initWithDelegate:self]
  20. }
  21.  
  22. - (CGFloat)heightForChunk:(Chunk *)chunk;
  23. {
  24.   // calculate height for the chunk here
  25. }
  26.  
  27. @end
  28.  
  29. @interface Chunk
  30.  
  31. @property (nonatomic, weak) id<ChunkDelegate> delegate;
  32.  
  33. - (instancetype)initWithDelegate:(id<ChunkDelegate>)delegate;
  34.  
  35. @end
  36.  
  37. @implementation Chunk
  38.  
  39. - (instancetype)initWithDelegate:(id<ChunkDelegate>)delegate;
  40. {
  41.     self = [super init];
  42.     if (self) {
  43.         self.delegate = delegate;
  44.     }
  45.     return self;
  46. }
  47.  
  48. @end
clone this paste RAW Paste Data