1

I want to understand what's the correct way to scale shapes of bezier curves for different screen sizes. Say, I've made an icon for a UIButton using UIBezierPath like this:

UIBezierPath* rectanglePath = [UIBezierPath bezierPath];
[rectanglePath moveToPoint: CGPointMake(6, 23)];
[rectanglePath addLineToPoint: CGPointMake(23, 23)];
[rectanglePath addLineToPoint: CGPointMake(23, 6)];
[rectanglePath addLineToPoint: CGPointMake(6, 6)];
[rectanglePath addLineToPoint: CGPointMake(6, 23)];
[rectanglePath closePath];
[UIColor.grayColor setFill];
[rectanglePath fill];

The coordinates have absolute values. How should scale this shape for different screen sizes?

  1. Do I have to parametrize the coordinates? I see this approach as difficult because shapes can be very complex.

  2. Or maybe I can apply some kind of transformation to a UIBezierPath to scale it to a size the corresponds to the screen size?

  3. Or do I have to create the code with bezier paths for each screen size and take it when needed?

Three options and I'm not sure which one is the correct.. Or maybe there is another option which I don't know yet?

Teja Nandamuri
  • 11,045
  • 6
  • 57
  • 109
Grigory
  • 992
  • 2
  • 18
  • 34

0 Answers0