Giter Site home page Giter Site logo

Comments (7)

RamonGilabert avatar RamonGilabert commented on July 20, 2024

You access the selected stack and remove all the images. Although ImagePicker is intended to keep reference for a while, in a composer for example, when you are building a post, and not be used as a general thing that you keep reference to. You can though.

let imagePickerController = ImagePickerController()
imagePickerController.stack.assets = []

Edit: You could also extend ImageStack and build a method to remove all the assets. That's up to you.

from imagepicker.

olivierlesnicki avatar olivierlesnicki commented on July 20, 2024

@RamonGilabert thanks! :)

from imagepicker.

olivierlesnicki avatar olivierlesnicki commented on July 20, 2024

Simply calling imagePickerController.stack.assets = [] doesn't refresh the existing UI elements (the old images are still showing as selected, the count still shows as x, etc...)

from imagepicker.

richardtop avatar richardtop commented on July 20, 2024

@olivierlesnicki just resetting assets won't work.
There is a method intended for that purpose:

 public func resetAssets(assetsArray: [PHAsset])

so, just try:

picker.stack.resetAssets([PHAsset]())

This design is related to some lower-level issues with property observers and notifications. Using the function I've provided the notification will be posted and all UI components should update their state automatically.

from imagepicker.

zenangst avatar zenangst commented on July 20, 2024

@olivierlesnicki did @richardoti's suggestion work for you?

from imagepicker.

olivierlesnicki avatar olivierlesnicki commented on July 20, 2024

@zenangst haven't tried yet

from imagepicker.

aashishdhawan avatar aashishdhawan commented on July 20, 2024

This has been taken care of in #162.

from imagepicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.