TextView frame visible but not displayable after Swift 3 animation

Note. I am using 1 pod ( iCarousel )

Note: project files https://ufile.io/vgopt <- I had problems with GitHub so I had to store project files in uploadfiles.io

I have compact maps that show basic data. After pressing "START" the maps expand and show more data: compact card / extended card

To achieve this animation I create all my constraints in advance programmatically (inside sculptureCard.swift). I assign different priority values ​​to each of my constraints, and then inside my ViewController "changeLayout" method, I change the priorities from 998 to 1 and vice versa.

The problem is that this new data is very long and I need to scroll down to see everything. I originally used (and I hope to use) scrollView. I decided to use a textView instead to keep it as simple as possible. However, only the HALF of my textView is responding to my gestures. enter image description here

I think my textView works ONLY in the scope that was originally limited; compact map view (textView also initially has a height of 0). But I need this textView to recognize gestures across the entire surface, not just half. A similar puzzle arises with my buttons. After the animation happens, only half of the button is disabled anymore. I believe the same issue that is affecting my textView is affecting my buttons. Possibly the wrong way to animate my looks. enter image description here

Also, but still associated with the need to increase the size of the cards by also changing the "y" position to -125. I believe this is the wrong way to change view frames. x: 0 y: 0 should move my map to the top of its carousel containing the view, but it doesn't. So I have to use -125. enter image description here

All the animation happens inside the ViewController's "changeLayout" method (very long, so no image). And all constraints are created in my custom "sculptureCard" class.

I change my views after the carousel container constraints were changed, I chained my animations with completion boxes. I call "view.layoutIfNeeded ()" all the time it takes (I think) to make this work. I've tried this method all over the place and under different circumstances. I have tried other methods like "layoutMargins" and "layoutSubViews" and almost anything I could think of might work.

I think I know what the problem is (the frame is not refreshed in my views even though the views are rendered correctly), but I can't seem to find a solution to this problem.

+3


source to share


1 answer


try yourView.isUserIntercationEnabled = true

and rebuild the constraints for your views after animating them. The part that appears after the animation is not referred to as your look due to old limitations.



0


source







All Articles