I use scaled affine transforms in Swift and noticed that CGAffineTransformMakeScale does not work the same in all versions of iOS. To demonstrate the differences, I created a new Xcode 7 project, installed three test windows on the Xcode Storyboard, running on an iOS7 device, iOS8 simulator and iOS9 simulator.
Box A - Unlimited and located in the center on top of the storyboard
Box B - has a height and width that are set along with the limitations of horizontal and central vertical alignment.
Box C - has a height and a width set along with the lower space and the horizontal alignment restrictions in the center.
The boxes are then scaled to 0.5 using the code below.
Note. The pink areas are not boxes or containers, but are used to highlight the position of the blue boxes after the affine scale transformation has occurred.
Results:
iOS7 has problems - while all the boxes halve their size, the two blocks, A and C, do not remain centered in place.
iOS8 / iOS9 works as expected - all boxes halve their size and remain centered in place, whether restrictions apply.
Questions:
What causes this problem and how is it best to fix and solve so that all versions of iOS7 / 8/9 work the same?
CGAffineTransformMakeScale on iOS7 - Doesn't scale as expected: - (

CGAffineTransformMakeScale on iOS8 / iOS9 - scales as expected :-)

code:
import UIKit class ViewController: UIViewController { @IBOutlet weak var ButtonA: UIButton! @IBOutlet weak var ButtonB: UIButton! @IBOutlet weak var ButtonC: UIButton! @IBAction func ButtonScale(sender: AnyObject) { self.ButtonA.transform = CGAffineTransformMakeScale(0.5, 0.5) self.ButtonB.transform = CGAffineTransformMakeScale(0.5, 0.5) self.ButtonC.transform = CGAffineTransformMakeScale(0.5, 0.5) } override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } }