title: iOS - Fill bezierPath with multiple colors based on percentage
body: <p>I drawed a UIBezierPath in Objective-C and fill it with a red color. Now, I want to fill the path with multiple colors based on percentage. For example: I want to fill the path with 20% green color and the remaining 80% with red color, on top of each other (not a gradient). I also want a few pixels spacing between the fill and the stroke.</p>
  
  <p>I don't know how I can accomplish these things. Does anyone know how I can accomplish this or point me in the right direction?</p>
  
  <p>Many thanks in advance!</p>
  
  <pre><code>UIBezierPath* bezierPath = UIBezierPath.bezierPath;
  [bezierPath moveToPoint: CGPointMake(50, 50)];
  [bezierPath addLineToPoint: CGPointMake(60, 90)];
  [bezierPath addLineToPoint: CGPointMake(80, 90)];
  [bezierPath addLineToPoint: CGPointMake(90, 50)];
  
  bezierPath.lineCapStyle = kCGLineCapRound;
  bezierPath.lineJoinStyle = kCGLineJoinBevel;
  
  [UIColor.redColor setFill];
  [bezierPath fill];
  [UIColor.blackColor setStroke];
  bezierPath.lineWidth = 4;
  [bezierPath stroke];
  </code></pre>