Search code examples
iosswiftcocoa-touchuiviewuilabel

How can I flip a label (get the mirror view) in Swift (Xcode 6.3)


I am trying to flip (get the mirror view) a label text with CGAffineTransformMakeRotation. But still no progress.

This code flips it vertically but I could not flip it horizontally.

self.labelShowdata.transform = CGAffineTransformMakeRotation((180.0 * CGFloat(M_PI)) / 180.0)

Thanks


Solution

  • Try this:

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

    Swift 5:

    self.table.transform = CGAffineTransform(scaleX: -1, y: 1);