How to store the images to the app in swift ios? -


    @ibaction func btnclicked(){      let alertcontroller = uialertcontroller(title: "choose option", message: "", preferredstyle: .alert)      let camerarollaction = uialertaction(title: "camera roll", style: .default) { (action) in         self.imagepicker.delegate = self         self.imagepicker.sourcetype = uiimagepickercontrollersourcetype.savedphotosalbum;         self.imagepicker.allowsediting = true         self.presentviewcontroller(self.imagepicker, animated: true, completion: nil)       }     alertcontroller.addaction(camerarollaction)      let takepictureaction = uialertaction(title: "take picture", style: .default) { (action) in         self.imagepicker.delegate = self         self.imagepicker.allowsediting = true         self.imagepicker.sourcetype = uiimagepickercontrollersourcetype.camera         self.imagepicker.cameracapturemode = .photo         self.imagepicker.modalpresentationstyle = .fullscreen         self.presentviewcontroller(self.imagepicker,             animated: true,             completion: nil)     }     alertcontroller.addaction(takepictureaction)    } 

how can store images app selecting device? whenever select images appears when close , reopen app image disappears.

an alternative can save images in app's document directory. , paths images can stored in nsuserdefaults.

check link saving images document directory :

click me !

add nsuserdefaults logic accordingly.

thanks.


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -