Horizontal scrolling in vertical scrolling, not allowing to stretch the image

I set the horizontal scroll to vertical scroll. Horizontal scrolling should contain a dynamic number of image representations in gallery style format. When the user drags the vertical scroll down, I want it to stretch the image in view while maintaining the aspect ratio to get the effect of a stretched type of title.

Without horizontal scrolling and only a container for viewing images, it works. However, when I present the horizontal scroll, the main view controller seems to show above the image, rather than pinning and stretching. I tried setting the contentInsetAdjustmentBehavior so that never in scrollview, but it does not work.

Here is where the image image is added to the content view:

 override func viewDidLoad() {
   super.viewDidLoad()
   let imageViewOne = UIImageView()

   imageViewOne.image = UIImage(named: "profile-image")!
   imageViewContainerView.addSubview(imageViewOne)
   imageViewOne.translatesAutoresizingMaskIntoConstraints = false
   imageViewOne.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
   imageViewOne.leftAnchor.constraint(equalTo: imageViewContainerView.leftAnchor).isActive = true
   imageViewOne.rightAnchor.constraint(equalTo: imageViewContainerView.rightAnchor).isActive = true
   imageViewOne.bottomAnchor.constraint(equalTo: imageViewContainerView.bottomAnchor).isActive = true
   imageViewOne.contentMode = .scaleAspectFill
 }

It does not scroll when stretched / reset, and it works enter image description here

This is scrolling when stretched / pulled down, and it does not work - you can see that it shows the main rear view, and not the image that I attached to the main view. I suspect this is due to nesting scrollable content in iOS 11.

enter image description here

Here is the storyboard setup: enter image description here

"imageViewContainerView" .

, , - , , ?

+4

Source: https://habr.com/ru/post/1691292/


All Articles