Я тщательно оценил ширину и высоту рисунка, и это дало мне 82 х 42 точки. Затем я применил масштабный коэффициент в коде, чтобы рисунок мог соответствовать кнопке, если размер кнопки масштабируется в xib.
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextScaleCTM(context, rect.size.width / 82, rect.size.height/ 42);
Теперь полный код выглядит следующим образом.
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextScaleCTM(context, rect.size.width / 82, rect.size.height/ 42);
{
UIColor* fillColor = [UIColor colorWithRed: 0.451 green: 0.855 blue: 1 alpha: 1];
UIBezierPath* clipPath = [UIBezierPath bezierPathWithRect: CGRectMake(0, 0.01, 81.6, 40.9)];
[clipPath addClip];
UIBezierPath* bezierPath = [UIBezierPath bezierPath];
[bezierPath moveToPoint: CGPointMake(81.21, 13.63)];
[bezierPath addCurveToPoint: CGPointMake(48.11, 40.91) controlPoint1: CGPointMake(84.3, 37.04) controlPoint2: CGPointMake(68.27, 40.91)];
[bezierPath addCurveToPoint: CGPointMake(0.72, 25.04) controlPoint1: CGPointMake(33.83, 40.91) controlPoint2: CGPointMake(3.32, 40.91)];
[bezierPath addCurveToPoint: CGPointMake(20.19, 0.94) controlPoint1: CGPointMake(-1.03, 14.37) controlPoint2: CGPointMake(-1.26, 0.28)];
[bezierPath addCurveToPoint: CGPointMake(81.21, 13.63) controlPoint1: CGPointMake(40.97, 1.57) controlPoint2: CGPointMake(78.62, -6.04)];
[bezierPath closePath];
[fillColor setFill];
[bezierPath fill];
}
}