title: Obj-C: Delegate method not getting called
body: <p>I'm new to iOS Dev, I'm following the Stanford CS193P classes for Fall 2010. I'm on assignment 3 and I'm setting my delegate to my view and by using the debugger I'm noticing the call to my delegate method won't happen, I don't understand what could be happening. My code is as follows:</p>
  
  <p><strong>GraphViewController.h:</strong></p>
  
  <pre><code>@interface GraphViewController : UIViewController &lt;GraphViewDelegate&gt; {
      GraphView *graphView;
      float scale;
  }
  
  @property (retain) IBOutlet GraphView *graphView;
  @property float scale;
  
  - (IBAction)zoomIn;
  - (IBAction)zoomOut;
  
  @end
  </code></pre>
  
  <p><strong>GraphViewController.m:</strong></p>
  
  <pre><code>@implementation GraphViewController
  
  @synthesize graphView, scale;
  
  - (NSString *)functionForGraph:(GraphView *)requestor {
      NSLog(@"%@", @"culo peluo");
      return @"lol";
  }
  
  - (float)scaleForGraph:(GraphView *)requestor {
      return self.scale;
  }
  
  - (IBAction)zoomIn {
  
  }
  
  - (IBAction)zoomOut {
  
  }
  
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
      if (self) {
  
      }
      return self;
  }
  
  - (void)dealloc
  {
      [super dealloc];
  }
  
  - (void)didReceiveMemoryWarning
  {
      // Releases the view if it doesn't have a superview.
      [super didReceiveMemoryWarning];
  
      // Release any cached data, images, etc that aren't in use.
  }
  
  #pragma mark - View lifecycle
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      self.graphView.delegate = self;
      self.scale = 20;
      [self.graphView setNeedsDisplay];
  }
  
  - (void)viewDidUnload
  {
      [super viewDidUnload];
      // Release any retained subviews of the main view.
      // e.g. self.myOutlet = nil;
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
      // Return YES for supported orientations
      return (interfaceOrientation == UIInterfaceOrientationPortrait);
  }
  
  @end
  </code></pre>
  
  <p><strong>GraphView.h:</strong></p>
  
  <pre><code>@class GraphView;
  
  @protocol GraphViewDelegate 
  - (NSString *)functionForGraph:(GraphView *)requestor;
  - (float)scaleForGraph:(GraphView *)requestor;
  @end
  
  @interface GraphView : UIView {
      id &lt;GraphViewDelegate&gt; delegate;
  }
  
  @property (assign) id &lt;GraphViewDelegate&gt; delegate;
  
  @end
  </code></pre>
  
  <p><strong>GraphView.m:</strong></p>
  
  <pre><code>@implementation GraphView
  
  @synthesize delegate;
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          // Initialization code
      }
      return self;
  }
  
  - (void)drawRect:(CGRect)rect
  {
      CGFloat cgScale = [self.delegate scaleForGraph:self];
      [AxesDrawer drawAxesInRect:self.bounds originAtPoint:self.center scale:cgScale]; 
  }
  
  
  - (void)dealloc
  {
      [super dealloc];
  }
  
  @end
  </code></pre>