I am using the below code in drawRect
CGContextSaveGState(context);
CGMutablePathRef outerPath=[self createPath:rect];
CGMutablePathRef innnerPath=[self createPath:UIEdgeInsetsInsetRect(rect, UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0)];
CGPathCloseSubpath(outerPath);
CGContextAddPath(context, outerPath);
CGContextSetFillColorWithColor(context, [UIColor colorWithRed:249.0/255.0 green:38.0/255.0 blue:1.0/255.0 alpha:1.0].CGColor);
CGContextEOFillPath(context);
CGContextDrawPath(context, kCGPathFill);
CGContextAddPath(context, innnerPath);
CGContextSetFillColorWithColor(context, [UIColor colorWithRed:50.0/255.0 green:213.0/255.0 blue:1.0 alpha:0.4].CGColor);
CGContextDrawPath(context, kCGPathFill);
CGContextRestoreGState(context);
But, since I am using 0.4 alpha for the inner colour , the inner colour becomes brown.
How can I have something like this as show in below?
I would just make a single rectangle, fill it with a cyan color, and stroke it with a red color. Make sure you set the stroke width to the size you need.