title: Creating Clickable CGPaths
body: <p>I have a UIView that contains a 'pie' with irregular sized slices and I need them to be clickable regions. Through a lot of trial and error I wrote a method to produce the pie, but now I am at a loss for how to make these slices into regions. Currently this method returns void so I need to modify to return something, like a CGPath? I guess where I'm really confused is how to take what I have and put it into a CGPath and return it. Any suggestions? thanks!</p>
  
  <pre><code>-(void)addClickableRegion:(float)beginDegrees to:(float)endDegrees withContext:(CGContextRef)ctx withRadiusOf:(int)rad{
      int x = self.bounds.size.height / 2;
      int y = self.bounds.size.width / 2;
  
      float red     = (arc4random() % 255)/255.0;
      float green   = (arc4random() % 255)/255.0;
      float blue    = (arc4random() % 255)/255.0;
  
      CGContextMoveToPoint(ctx, x, y);
      CGContextAddArc(ctx, x, y, rad, (beginDegrees) * M_PI/180.0, (endDegrees) * M_PI/180.0, 0);
  
      CGContextSetRGBFillColor(ctx, red, green, blue, 1.0);
  
      CGContextFillPath(ctx);
      CGContextClosePath(ctx);
  }
  </code></pre>