0

Hi I am making a simple login screen for my app in xCode and want to make sure that it fits any screen

import UIKit

class LoginController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
    // will allow me to put a image as my UI background instead of a color
    self.view.backgroundColor = UIColor(patternImage: UIImage(named:"BestBackground")!)
}

}

This successfully loads the image but i just want to make sure it will load on any screen size from iPhone 6 to iPhone 6 Plus

1 Answers1

0

Don't set the background to a pattern. Just add a UIImageView behind all the other views. Set its contentMode to scaleAspectFill and set its image to your "BestBackground" image. You can do all of this is the storyboard or in code.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848