Search code examples
iphoneiosuiviewcgaffinetransform

Reverse UIView without its subviews


I'm trying to reverse an UIView with some subviews on it (UILabels,Buttons, and so on...)

I'm doing this by

self.transform = CGAffineTransformMakeScale(-1,1);

Is there an easy way to prevent the subviews from being reversed


Solution

  • You could apply the same transform to all the subviews, so that they're reversed twice:

    CGAffineTransform t = CGAffineTransformMakeScale(-1, 1);
    self.transform = t;
    for (UIView *subview in self.subviews) {
        subview.transform = t;
    }