There is a UIScrollView. He does not scroll if you pull for example a button, a picture, and so on. How to fix it?

ImageView code (here is ScrollView)

import Foundation class ImageView: UIScrollView, UIScrollViewDelegate { @IBOutlet var scrollView: UIScrollView! @IBOutlet weak var viewForImages: UIView! var view: UIView? let nibName = "ImageView" required init() { super.init(frame: CGRect.zero) self.view = self.loadFromNib() } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } func loadFromNib() -> UIView { let bundle = Bundle(for: type(of: self)) let nib = UINib(nibName: nibName, bundle: bundle) let view = nib.instantiate(withOwner: self, options: nil).first as! UIView self.scrollView.delegate = self return view } } 

MenuView code (this is where xib view is loaded)

 import Foundation class MenuView: UIView { @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var orderButton: UIButton! @IBOutlet weak var constraint: NSLayoutConstraint! @IBOutlet weak var contentView: UIView! @IBOutlet weak var languageHelpButton: UIButton! @IBOutlet weak var taxiButton: UIButton! @IBOutlet weak var gidButton: UIButton! @IBOutlet weak var priceButton: UIButton! @IBOutlet weak var imageView: UIView! var imgView: ImageView? let nibName: String = "MenuView" var view: UIView? required init() { super.init(frame: CGRect.zero) self.view = self.loadFromNib() let const = (self.view?.frame.size.height)! - (UIScreen.main.bounds.size.height-200.0) print("const=\(const)") print("view.height:\(self.view?.frame.size.height)" ) print("screen.height:\(UIScreen.main.bounds.size.height)") self.constraint.constant = const } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } func loadFromNib() -> UIView { let bundle = Bundle(for: type(of: self)) let nib = UINib(nibName: nibName, bundle: bundle) let view = nib.instantiate(withOwner: self, options: nil).first as! UIView imgView = ImageView() self.imageView.addSubview((self.imgView?.view!)!) return view } } 
  • Everything should work if you have not added any custom handlers. and if added, show the code - Max Mikheyenko
  • @MAXMikheyenko added code, but in principle it seems that no handlers were added - Razorik
  • Can help tutorial from Ray, try is worth raywenderlich.com/122139/uiscrollview-tutorial - Kerim Khasbulatov
  • @IsmailHasbulatov has put labels instead of pictures, he will not scroll either. I had to mention earlier that I have a full-screen map on my main view. And when you click on a point on the map, I see a full-screen view over the map. This view is scrolled vertically, and inside this view is a horizontal view with photos. And when I try to scroll it - the view disappears and the map moves along with the cursor. - Razorik

0