Skip to content
Snippets Groups Projects
Commit 11c960f7 authored by Nathan's avatar Nathan
Browse files

Merge remote-tracking branch 'refs/remotes/origin/main'

Conflicts:
	Pendu/Base.lproj/Main.storyboard
parents 3328020f 79adf337
No related branches found
No related tags found
No related merge requests found
File added
This diff is collapsed.
import UIKit
extension UIView {
func addBackgroundAcceuil(imageName: String = "fond_acceuil.png", contentMode: UIView.ContentMode = .scaleToFill) {
// setup the UIImageView
let backgroundImageView = UIImageView(frame: UIScreen.main.bounds)
backgroundImageView.image = UIImage(named: imageName)
backgroundImageView.contentMode = contentMode
backgroundImageView.translatesAutoresizingMaskIntoConstraints = false
addSubview(backgroundImageView)
sendSubviewToBack(backgroundImageView)
// adding NSLayoutConstraints
let leadingConstraint = NSLayoutConstraint(item: backgroundImageView, attribute: .leading, relatedBy: .equal, toItem: self, attribute: .leading, multiplier: 1.0, constant: 0.0)
let trailingConstraint = NSLayoutConstraint(item: backgroundImageView, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing, multiplier: 1.0, constant: 0.0)
let topConstraint = NSLayoutConstraint(item: backgroundImageView, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1.0, constant: 0.0)
let bottomConstraint = NSLayoutConstraint(item: backgroundImageView, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1.0, constant: 0.0)
NSLayoutConstraint.activate([leadingConstraint, trailingConstraint, topConstraint, bottomConstraint])
}
}
class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate {
@IBAction func ranking(_ sender: Any) {
}
@IBAction func myScore(_ sender: Any) {
}
@IBOutlet weak var classement: UIButton!
@IBOutlet weak var pseudoinput: UITextField!
@IBOutlet weak var choixTheme: UIPickerView!
@IBOutlet weak var choixNiv: UISegmentedControl!
@IBAction func ank(_ sender: Any) {
}
var wordToGuess : String = ""
let pickerData = ["Animals", "Sports", "Food", "Cities", "Colors"]
var gameEngine : GameEngine = GameEngine()
override func viewDidLoad() {
super.viewDidLoad()
view.addBackgroundAcceuil()
choixTheme.dataSource = self
choixTheme.delegate = self
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment