I've a series of cells that resize using a UIPinchGestureRecognizer with something like
pinchGesture.view?.transform = (pinchGesture.view?.transform)!.scaledBy(x: deltaScale, y: deltaScale)
and it works fine. However, I had some buttons and a label on the cell that appear when the cell is tapped, and these would resize with the superview when pinched to zoom (so the buttons would be too small to press / large not conforming to the design).
So I programmatically added a view to my cells when tapped to solve this:
let myView = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
myView.backgroundColor = UIColor.red
var label = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 21))
label.text = "I'm a test label"
myView.addSubview(label)
I added
myView.translatesAutoresizingMaskIntoConstraints = false
But the subview myView still resizes!
How can I stop the subview "myView" from resizing?