title: unrecognized selector sent to instance when assigning delegate to my PieChartView
body: <p>Hi I have searched and search and then I have decided to post it here - this question may be silly to you but it costs me already one day:(</p>
  
  <p>So I am trying to use the XYPieChart to draw some pie charts, here some some codes from XYPieChart:</p>
  
  <p>XYPieChart.h</p>
  
  <pre><code>@class XYPieChart;
  @protocol XYPieChartDataSource &lt;NSObject&gt;
  @required
  - (NSUInteger)numberOfSlicesInPieChart:(XYPieChart *)pieChart;
  - (CGFloat)pieChart:(XYPieChart *)pieChart valueForSliceAtIndex:(NSUInteger)index;
  @optional
  - (UIColor *)pieChart:(XYPieChart *)pieChart colorForSliceAtIndex:(NSUInteger)index;
  - (NSString *)pieChart:(XYPieChart *)pieChart textForSliceAtIndex:(NSUInteger)index;
  @end
  
  @protocol XYPieChartDelegate &lt;NSObject&gt;
  @optional
  - (void)pieChart:(XYPieChart *)pieChart willSelectSliceAtIndex:(NSUInteger)index;
  - (void)pieChart:(XYPieChart *)pieChart didSelectSliceAtIndex:(NSUInteger)index;
  - (void)pieChart:(XYPieChart *)pieChart willDeselectSliceAtIndex:(NSUInteger)index;
  - (void)pieChart:(XYPieChart *)pieChart didDeselectSliceAtIndex:(NSUInteger)index;
  @end
  </code></pre>
  
  <p>XYPieChart.m</p>
  
  <pre><code>@synthesize dataSource = _dataSource;
  @synthesize delegate = _delegate;
  </code></pre>
  
  <p>And then in my own view controller XYPieChartViewTestViewController.h </p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "XYPieChart.h"
  
  @interface XYPieChartViewTestViewController : UIViewController &lt;XYPieChartDelegate,      XYPieChartDataSource&gt;
  @property (weak, nonatomic) IBOutlet XYPieChart *MyPieCharts;
  @end
  </code></pre>
  
  <p>And XYPieChartViewTestViewController.m</p>
  
  <pre><code>#import "XYPieChartViewTestViewController.h"
  
  @interface XYPieChartViewTestViewController ()
  @end
  @implementation XYPieChartViewTestViewController
  @synthesize MyPieCharts = _MyPieCharts;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.
  
      [_MyPieCharts setDelegate:self];
  }
  </code></pre>
  
  <p>But when executing [_MyPieCharts setDelegate:self];, there is a dump:</p>
  
  <p>2012-10-16 10:33:53.100 XYPieChartViewTest[3859:11303] -[UIView setDelegate:]: unrecognized selector sent to instance 0x9040680
  <em>*</em> First throw call stack:
  libc++abi.dylib: terminate called throwing an exception</p>
  
  <p>If I put a breakpoint at the line "[_MyPieCharts setDelegate:self];", and PO self._MyPieCharts.delegate, it says:</p>
  
  <p>po self.MyPieCharts.delegate
  error: Execution was interrupted, reason: Attempted to dereference an invalid ObjC Object or send it an unrecognized selector.
  The process has been returned to the state before execution.</p>
  
  <p>I have uploaded the project <a href="http://www.4shared.com/zip/dBCBCOJI/XYPieChartViewTest.html" rel="nofollow">here</a> since I cannot post screen shots. </p>
  
  <p>Does this mean that self.MyPieCharts.delegate is not initialized? Do you have any idea what should I do?</p>
  
  <p>Thanks a lot!</p>