UIView bounds and transformsBasics article available: Layout Anchors
A really interesting side-effect of a
bounds being its rect within its own coordinate system is that transforms don't affect it at all. That's why it's usually a better fit than
frame when doing layout calculations of subviews.
let view = UIView() view.frame.size = CGSize(width: 100, height: 100) view.transform = CGAffineTransform(scaleX: 2, y: 2) print(view.frame) // (-50.0, -50.0, 200.0, 200.0) print(view.bounds) // (0.0, 0.0, 100.0, 100.0)
Enter Manning’s September Showdown — a 30-day challenge that gives developers a chance to test their knowledge against their peers. A new trivia question, and a brand new prize to win, is published every day throughout September.