[SWIFT] I was addicted to scrollview because I couldn't tap the variable size UIView

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.

solution

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

I was addicted to scrollview because I couldn't tap the variable size UIView
I was addicted to the roll method
I was addicted to the Spring-Batch test
I was addicted to the NoSuchMethodError in Cloud Endpoints
A memorandum because I was addicted to the setting of the Android project of IntelliJ IDEA
What I was addicted to when introducing the JNI library
I was addicted to looping the Update statement on MyBatis
I was addicted to the setting of laradock + VSCode + xdebug
What I was addicted to with the Redmine REST API
The story I was addicted to when setting up STS
I was addicted to starting sbt
About the matter that I was addicted to how to use hashmap
I was addicted to the API version min23 setting of registerTorchCallback
I was addicted to rewriting to @SpringApplicationConfiguration-> @SpringBootTest
Memorandum: What I was addicted to when I hit the accounting freee API
[Rails] I was addicted to the nginx settings when using Action Cable.
A story I was addicted to when testing the API using MockMVC
Problems I was addicted to when building the digdag environment with docker
[CircleCI] I was addicted to the automatic test of CircleCI (rails + mysql) [Memo]
I was addicted to unit testing with the buffer operator in RxJava
I was addicted to using RXTX on Sierra
I was addicted to installing Ruby/Tk on MacOS
I was addicted to doing onActivityResult () with DialogFragment
The part I was addicted to in "Introduction to Ajax in Java Web Applications" of NetBeans
What I fixed when updating to Spring Boot 1.5.12 ・ What I was addicted to
[Rails] [bootstrap] I want to change the font size responsively
What I was addicted to while using rspec on rails
I was addicted to setting default_url_options with Rails devise introduction
A story I was addicted to in Rails validation settings
I was confused because there was a split in the Array
I was addicted to using Java's Stream API in Scala
What I was addicted to when updating the PHP version of the development environment (Docker) from 7.2.11 to 7.4.x
[Circle CI] A story I was addicted to at Start Building
I tried to summarize what was asked at the site-java edition-
What I was addicted to when implementing google authentication with rails
I checked because the response was strange when debugging with Tomcat 8
The story that I struggled because I couldn't do "Rails db: migrate".
Don't lose to the unchecked warning! → After all, I couldn't win the unchecked warning ...
I was able to deploy the Docker + laravel + MySQL app to Heroku!
A story that I was addicted to twice with the automatic startup setting of Tomcat 8 on CentOS 8