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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -