Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete image #271

Open
MagicFlow29 opened this issue Dec 20, 2020 · 3 comments
Open

Delete image #271

MagicFlow29 opened this issue Dec 20, 2020 · 3 comments

Comments

@MagicFlow29
Copy link

Step 1 - enable delete button:
LightboxConfig.DeleteButton.enabled = true

Step 2 - Delete:

Crash on:
let pageView = pageViews[i]
in:

  func reconfigurePagesForPreload() {
    let preloadIndicies = calculatePreloadIndicies()

    for i in 0..<initialImages.count {
      let pageView = pageViews[i]
      if preloadIndicies.contains(i) {
        if type(of: pageView.image) == LightboxImageStub.self {
          pageView.update(with: initialImages[i])
        }
      } else {
        if type(of: pageView.image) != LightboxImageStub.self {
          pageView.update(with: LightboxImageStub())
        }
      }
}

}

@MagicFlow29
Copy link
Author

Fixed by adding the following line:
self.initialImages.remove(at: prevIndex)

to func headerView(_ headerView: HeaderView, didPressDeleteButton deleteButton: UIButton) {

noting the above function is also lacking a delegate

@alexandrgl
Copy link

This fix is already in this pull request - #265
I think the repo maintainer just have to release new version.

@3lvis
Copy link
Collaborator

3lvis commented Jan 30, 2021

Ok! New version coming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants