Guest User

Untitled

a guest
Nov 21st, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. private func setupBackgroundImage() {
  2. backgroundImageView = UIImageView(frame: bounds)
  3. addSubview(backgroundImageView)
  4. backgroundImageView.contentMode = .scaleAspectFill
  5. backgroundImageView.clipsToBounds = true
  6. backgroundImageView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
  7. }
  8.  
  9. private func setupGradient() {
  10. gradientView = GradientView(frame: CGRect(x: 0, y: bounds.height, width: bounds.width, height: -60.0))
  11. addSubview(gradientView)
  12. gradientView.gradientLayer.colors = [
  13. UIColor.black.withAlphaComponent(0.0).cgColor,
  14. UIColor.black.withAlphaComponent(0.7).cgColor
  15. ]
  16. gradientView.autoresizingMask = [.flexibleWidth, .flexibleTopMargin]
  17. }
  18.  
  19. private func setupLabel() {
  20. label = UILabel(frame: CGRect.zero)
  21. addSubview(label)
  22. label.font = UIFont.boldSystemFont(ofSize: 24.0)
  23. label.textColor = .white
  24. label.translatesAutoresizingMaskIntoConstraints = false
  25. NSLayoutConstraint.activate(
  26. [
  27. label.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 16.0),
  28. label.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -16.0),
  29. label.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -8.0)
  30. ]
  31. )
  32. }
Add Comment
Please, Sign In to add comment