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

Dismissing ViewControllers above causes UI bug #16

Closed
LinusGeffarth opened this issue Oct 30, 2017 · 11 comments
Closed

Dismissing ViewControllers above causes UI bug #16

LinusGeffarth opened this issue Oct 30, 2017 · 11 comments
Assignees

Comments

@LinusGeffarth
Copy link

LinusGeffarth commented Oct 30, 2017

EDIT

It was not setting the image programmatically that causes the issue, but dismissing a UIViewController above the one with the image after presenting it as a popover i.e..
Below the original post.


I have set UIImageViewAligned as my UIImageView's class in storyboard, enabled right alignment and provided an image:

screen shot 2017-10-30 at 14 18 32

It works just like it should until I update the image programmatically like:

imageView.image = UIImage(named: "account.png")!

This results in the following UI:

screen shot 2017-10-30 at 14 19 30

Any idea why this happens & what I can do about it?

@sochalewski
Copy link
Owner

sochalewski commented Oct 30, 2017

Looks like a bug. Thank you for your report, I'll investigate this within a few days. Could you please let me know which version do you use?

@LinusGeffarth
Copy link
Author

LinusGeffarth commented Oct 30, 2017

Cool, thanks for taking care of this. I am currently on 0.5.0 and am using CocoaPods

@sochalewski
Copy link
Owner

sochalewski commented Nov 2, 2017

@LinusGeffarth Just checked it out on iOS 11.1 and it seems to work just fine.
Take a look at the example I provided and compare it to your code.

Demo

@LinusGeffarth
Copy link
Author

Hm, true. I figured when I set the image at some other point in my code, it does work w/o issues. It's probably about constraint refreshes I'm committing...
Thanks anyway!

@LinusGeffarth
Copy link
Author

I've found the issue. Whenever you present a view controller on the view controller with the image view inside, and then dismiss it, the bug occurs. Check out the zip. Make sure to run it on an iPad, I've only experienced the issue with popovers.

Test.zip

@sochalewski
Copy link
Owner

sochalewski commented Nov 2, 2017

I got it. Just released 0.5.1-beta which resolves the issue, but may implement some new :)

To check it out change one of lines in your Podfile to
pod 'UIImageViewAlignedSwift', '~> 0.5.1-beta'
and then run pod update --repo-update.

@LinusGeffarth
Copy link
Author

LinusGeffarth commented Nov 2, 2017

Awesome! I have updated to the beta and it works for the test project. However, for mine, it doesn't. I'm still debugging.
My structure:

Nav
    -> PageController
        -> Nav
            -> VC
                -> TabBar
                    -> Nav
                        -> VC
                            -> VC over full screen, w/ image view
                                -> Popover that's to be dismissed

Maybe that helps...


Edit

I only experience it in one VC so it's probably some other issue. Geez. Ha!

@sochalewski
Copy link
Owner

Wow, it looks crazy :) I have no idea at this moment, but I'll try resolve this. Nevertheless feel free to post your solution or pull request when you got something 👍

@LinusGeffarth LinusGeffarth changed the title Programmatically setting image causes UI bug Dismissing ViewControllers above causes UI bug Nov 3, 2017
@lkravchuk
Copy link
Contributor

lkravchuk commented Nov 9, 2017

I was able to reproduce the bug on the iOS11+ only and it seems that it's still there even in updated 0.5.1-beta. ImageView was added to storyboard with aspect Fit content mode and left alignment ON
You can replicate this behavior by using the system alerts with 0.5.0
Or by pushing some view with 0.5.1-beta
Trying to figure out how to fix it

Update
Well, still have no idea why, but it seems that on iOS 11 any changes on parent view controller causes the showing of image and realImageView?.image at the same time, so using the last fix from beta branch + re-assigning the image inside didMoveToWindow() fixed it for me, but would be great if to test this more to be sure that there will be no more side-effects.

@ToniTornado
Copy link

I used the latest beta branch but still had this issue. To reproduce it, I had to start the app, dismiss it (home button), bring it to foreground and then rotate the view.

Maybe this helps someone debugging it...

@Niegazowana
Copy link

Hi! I opened a PR to solve this issue

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

No branches or pull requests

5 participants