我有覆盖整个视图的UIImage以及从其照片库设置图像的选项。如何让iOS应用程序记住用户从UIImagePickerController中选择的图像
我的问题是每当我完全关闭应用程序,UIImage恢复到默认图像。
这里是我的代码,如果你需要看它:
@IBAction func wallpaperMenuPressed(sender: AnyObject) {
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
self.imagePicker.delegate = self
self.imagePicker.sourceType = .PhotoLibrary;
self.imagePicker.allowsEditing = false
// The app is running on an iPad, so you have to wrap it in a UIPopOverController
self.imagePicker.modalPresentationStyle = .Popover
presentViewController(self.imagePicker, animated: true, completion: nil)//4
imagePicker.popoverPresentationController?.sourceView = wallpaperMenu
imagePicker.popoverPresentationController?.sourceRect = (sender as! UIButton).bounds
} else {
self.imagePicker.delegate = self
self.imagePicker.sourceType = .PhotoLibrary;
self.imagePicker.allowsEditing = false
presentViewController(imagePicker, animated: true, completion: nil)
}
}
我已经得到了那些已经在那里,我可以得到图像,但不记得它下一次 – Khoury
太感谢你了,它完美 – Khoury