Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import UIKit
  2.  
  3. class ViewController: UIViewController {
  4.  
  5. @IBOutlet var photo: UIImageView!
  6. override func viewDidLoad() {
  7. super.viewDidLoad()
  8. // Do any additional setup after loading the view.
  9.  
  10. photo.image = UIImage(named:"test.png")
  11. photo.contentMode = .scaleAspectFill
  12.  
  13. let width = self.photo.bounds.size.width
  14. let height = self.photo.bounds.size.height
  15.  
  16. let imageViewBackground = UIImageView(frame: CGRect(x:0,y:0,width:width,height:height))
  17. imageViewBackground.image = UIImage(named:"DG.png")
  18.  
  19. imageViewBackground.contentMode = .scaleAspectFit
  20.  
  21. photo.addSubview(imageViewBackground)
  22. photo.sendSubviewToBack(imageViewBackground)
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement