Reputation: 2061
I created this UIImageView in Xcode and then added an image. See the picture below :
Then I added this code to try to change the UIImageView but its not working:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var border: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
let width = UIScreen.mainScreen().bounds.width
let height = UIScreen.mainScreen().bounds.height
border.frame.size.width = width
border.frame.size.height = height
}
Upvotes: 0
Views: 217
Reputation: 1091
I believe you have to do this in ViewDidLayoutSubviews, not ViewDidLoad:
override func viewDidLayoutSubviews() {
}
Upvotes: 1