Reputation: 4332
I did the following:
1) copy 3 images size of wall paper into supporting file folder with standard naming
WP.png, [email protected], [email protected]
override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor(patternImage: UIImage(named: "WP")) }
The problems:
1). There are 3 images overlap one another
2) if I did as below, the same problem as (1)
self.view.backgroundColor = UIColor(patternImage: UIImage(named: "WP@2x"))
or
self.view.backgroundColor = UIColor(patternImage: UIImage(named: "[email protected]"))
How to make sure the wp size for the right screen size?
TIA.
Upvotes: 0
Views: 122
Reputation: 903
Make sure you use the name you provide here (see arrow in image). XCode will add the right image.
You can also specify the size by hand if you must. This goes as follows:
self.yourImageVariableName.size.width = self.frame.size.width
self.yourImageVariableName.size.height = self.frame.size.height
Upvotes: 0