我有覆蓋整個視圖的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