title: How to correct UIView and UILabel text scaling with pixelation?
body: <p>When I add a <code>UILabel</code> with text to a <code>UIView</code> and then scale the <code>UIView</code>, the contents is displayed with pixelation. The greater the scale factor, the greater the pixelation.</p>
  
  <p>I understand using a <code>CATextLayer</code> might be able to assist and could display the scaled <code>UIView</code> and <code>UILabel</code> text without pixelation but I don't know how to implement it.</p>
  
  <p>This is how I create a triangle and scale it with no pixelation. It scales with perfect sharp edges.</p>
  
  <p><strong><em>How can I ensure the same when scaling a <code>UILabel</code> ?</em></strong></p>
  
  <pre><code>func drawTriangle() {
      let path = UIBezierPath()
      path.moveToPoint(CGPoint(x: 0, y: 100))
      path.addLineToPoint(CGPoint(x: 100, y: 100))
      path.addLineToPoint(CGPoint(x: 50, y: 0))
      path.closePath()
  
      let shape = CAShapeLayer()
      shape.path = path.CGPath
      shape.fillColor = UIColor.blackColor().CGColor
  
      viewTriangle.layer.insertSublayer(shape, atIndex: 0)
  }
  
  func scaleTriangle() {
      viewTriangle.transform = CGAffineTransformMakeScale(5, 5)
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Question:</strong></p>
  
  <p><strong><em>In Swift code, how do I convert the below to use a <code>CATextLayer</code> so that it scales with no pixelation?</em></strong></p>
  
  <hr>
  
  <p><strong>Problem code:</strong></p>
  
  <pre><code>func drawLetter() { // pixelated when scaled ?
      let labelLetter = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
      labelLetter.text = "A"
      labelLetter.backgroundColor = UIColor.clearColor()
      labelLetter.textColor = UIColor.blackColor()
      labelLetter.font = UIFont(name: labelLetter.font.fontName, size: 144)
      labelLetter.textAlignment = .Center
      viewLetter.addSubview(labelLetter)
      }
  }
  
  func scaleView() {
      let scaleValue: CGFloat = 5
      self.viewLetter.transform = CGAffineTransformMakeScale(scaleValue, scaleValue)
  }
  </code></pre>
  
  <p><strong>Image:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/yzQTd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yzQTd.png" alt="enter image description here"></a></p>