Search code examples
iosobjective-crotationscaleprogress

Progress View Flip and Scale


I am trying to flip a UIProgressView 180 in Xcode and I am trying to scale the progress view at the same time. The scaling works great until I add the flip and then the scaling does not work anymore. Any suggestions? Thanks!

[self.secondsPorgressBarTicker setTransform:CGAffineTransformMakeScale(1.0, 10.0)];

[self.secondsPorgressBarTicker setTransform:CGAffineTransformMakeRotation(-M_PI)];

Solution

  • You are setting the transform and then resetting it. If you want to combine transforms, you need to use different CG functions. Remember, order matters with transforms, so use whichever one solves your issue:

    CGAffineTransform transform = CGAffineTransformMakeRotation(-M_PI);
    transform = CGAffineTransformScale(transform, 1.0, 10.0);
    [self.secondsPorgressBarTicker setTransform:transform];
    

    or

    CGAffineTransform transform = CGAffineTransformMakeScale(1.0, 10.0);
    transform = CGAffineTransformRotate(transform, -M_PI);
    [self.secondsPorgressBarTicker setTransform:transform];