New to coding, I've figured out how to let a user select a photo as their background with the following code
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
backgroundImage.contentMode = .ScaleAspectFill
backgroundImage.image = pickedImage
}
dismissViewControllerAnimated(true, completion: nil)
}
// Wallpaper function
@IBAction func wallpaperMenuPressed(sender: AnyObject) {
imagePicker.allowsEditing = false
imagePicker.sourceType = .PhotoLibrary
presentViewController(imagePicker, animated: true, completion: nil)
}
And it works, still haven't figured out how to save it but will find out soon.
But, if I have a backgroundImage in all my views, how do I get it to set the same image for all of them?
Thanks