I am writing the application "Calculator". Set the size of the buttons for a 3.5 inch screen. I want to make a software "stretching" of the sizes to proportions 4, 4.7 and 5.5 inches. Everything works as it should when pressing the Button button, but when the screen is rebuilt (drawing numbers in the text field), the dimensions return to their original size.
How to "fix" the scaling occurred?
Also I can not understand how to make the resizing happen when the application starts. On the image above, the buttons should stretch and close the empty space on the right of the 4in screen.
class ViewController: UIViewController { @IBOutlet weak var Label1: UILabel! @IBOutlet var BTN: [UIButton]! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func But(sender: AnyObject) { let screenSize: CGRect = UIScreen.mainScreen().bounds let scaleX = screenSize.width / 480 let scaleY = screenSize.height / 320 if scaleX == 1 && scaleY == 1 { return } for btn in BTN { btn.frame.origin.x *= scaleX btn.frame.origin.y *= scaleY btn.frame.size.height *= scaleY btn.frame.size.width *= scaleX } } 





