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

[Feature Request] - Expose a property to retrieve configured image #1

Closed
sabiland opened this issue Nov 4, 2022 · 11 comments
Closed
Assignees

Comments

@sabiland
Copy link

sabiland commented Nov 4, 2022

It would be helpful (at least for me) to be able to get back configured/original image. I see imageView is private var and cannot get image without modifying your code.

@egzonpllana
Copy link
Owner

Hi @sabiland, does the API .cropAndGetImage() do the job for you, or the delegate method didCropImage(image: UIImage, fromView: InteractiveImageView)?

@egzonpllana egzonpllana self-assigned this Nov 4, 2022
@sabiland
Copy link
Author

sabiland commented Nov 4, 2022

I would like to retrieve exactly (without any modification, no cropping, nothing) the same (or maybe cloned version if you wish) image which was configured. That would be very practical (again, at least for me :)).

Some extra questions:

  1. I need to update image a lot. How should be done best way? Just calling configure again or?
  2. Is it possible to reset (setting image == nil), so there is no image shown?

@egzonpllana
Copy link
Owner

Now I understand, I will try to push the improvement to retrieve the original image today. About your questions:

  1. I can introduce a new method to change only the image of the image view, and not change other attributes.
  2. You can use the first option to set the image to nil.

These requests seem useful also to me, do these changes resolve your challenges?

@sabiland
Copy link
Author

sabiland commented Nov 4, 2022

Yes, great, everything you said above resolve my challenges :).

Sorry another quick question (just now I ran my app for the first time). Is the default background color of your master view White right? Could this also be settable? Would be nice to have it for UIColor.clear, etc.

EDIT: .backgroundColor = UIColor.clear already solves this.

@sabiland
Copy link
Author

sabiland commented Nov 4, 2022

Sorry if I ask too many questions/requests, they are just popping to my mind now that I am testing your library.

  1. IIVContentMode mode to be added to be able to show whole loaded picture

@sabiland
Copy link
Author

sabiland commented Nov 4, 2022

One more thing, I see you used ImageScrollView as reference? I have already long time ago locally modified ImageScrollView's method for device orientations, because otherwise there were issues when zooming/panning/etc.

  1. isValidInterfaceOrientation check (this solved problems)
  2. And I ignored that method on iPhones (but this is probably just for my case, I allow only Portrait mode in my App), maybe this could be configurable also?
@objc func changeOrientationNotification() {
        
        // SABI TWEAK
        // SABI TWEAK
        // SABI TWEAK
        if Helper.checkIPhone()
        {
            // Ignore ON IPHONE !!!
            // Ignore ON IPHONE !!!
            // Ignore ON IPHONE !!!
            return
        }
        else
        {
            if UIDevice.current.orientation.isValidInterfaceOrientation
            {
                // On iPad ONLY if valid orientation !!!
                // On iPad ONLY if valid orientation !!!
                // On iPad ONLY if valid orientation !!!
                
                // A weird bug that frames are not update right after orientation changed. Need delay a little bit with async.
                DispatchQueue.main.async {
                    self.configureImageForSize(self.imageSize)
                    self.imageScrollViewDelegate?.imageScrollViewDidChangeOrientation(imageScrollView: self)
                }
            }
        }
    }

@egzonpllana
Copy link
Owner

Point 3 requires more work and I will try to implement it next week. For the "changeOrientationNotification", I will have to investigate more.

@sabiland
Copy link
Author

sabiland commented Nov 4, 2022

Thx for your effort in advance.

@egzonpllana
Copy link
Owner

New methods added in version 1.0.23:

  • interactiveImageView.getOriginalImage()
  • interactiveImageView.setImage(UIImage)

@IBOutlet weak var interactiveImageView: InteractiveImageView!

@sabiland
Copy link
Author

sabiland commented Nov 4, 2022

Will test it today and tomorrow.

@sabiland
Copy link
Author

sabiland commented Nov 5, 2022

I have tested it.

  1. Now whole image (toggle) presented works OK. Did you change anything about this?
  2. Also getting/setting image works OK
  3. But yes, there is an issue when tilting device and zooming/panning at the same time. Twitchy re-zooming-positionings happen. I think that solution above (valid orientations) should/could solve the problem.

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

2 participants