Search code examples
iosdrawrectuibezierpathcatransform3d

Draw UIBezierPath in small view


I have signature view, when signature is done I reduce view and save UIBezierPath. When I set UIBezierPath to small view and call setNeedsDisplay, view doesn't draw lines. Maybe problem in scale?
Big view
enter image description here
Reduced view
enter image description here
After setting path and calling setNeedsDisplay
enter image description here


Solution

  • Try to use:

    self.layer.transform = CATransform3DMakeScale(1./3., 1./3., 1);
    

    this will make your view 3 times smaller but the actual drawing will be in same size, so coordinates in your path wont be messed up.

    For showing SignatureView just make the scale normal like this:

    self.layer.transform = CATransform3DIdentity
    

    Good luck ;)