Using ContainerVC, I was creating a UIView whose size changes when a button is pressed. For this UIView, use tapgestureRecognizer or touchesbegan. I was able to detect taps. (Reference https://qiita.com/Kyome/items/d86cefa9dbd7bd2d7cf0)
When the button is pressed
a.swift
@IBOutlet weak var containerVCWidth: NSLayoutConstraint!
self.myScrollView.contentSize.width += 100
self.view.frame = CGRect(x: 0, y: 0, width: self.view.frame.width + 100, height: self.view.frame.height)
}
However, there was a phenomenon that the view became large but could not be tapped.
Constraints on the width of containerView It seems that I had to connect to the outlet and increment it too.
a.swift
@IBOutlet weak var containerVCWidth: NSLayoutConstraint!
@IBAction func tappedButton(_ sender: Any) {
self.myScrollView.contentSize.width += 100
containerVCWidth.constant += 100
}
Recommended Posts