Buttons are disabled in a ScrollView - iOS Swift
<p>I have a button in a view inside a view inside a ScrollView:</p>

<pre><code>UIScrollView
-ContentView
--PhoneNumberView
---UIButton
</code></pre>

<p>If the scrolling ability of the ScrollView is disabled the button clicks normally. However, if the scrolling is enabled the button seems to be disabled.</p>

<p>This is how I sent the content size of the ScrollView:</p>

<pre><code>var contentRect = CGRectZero;
for view in self.contentView.subviews {
     contentRect = CGRectUnion(contentRect, view.frame)
}
scrollView.contentSize = contentRect.size
scrollView.contentSize.height = scrollView.contentSize.height+20
</code></pre>

<p>and I also set those properties</p>

<pre><code>scrollView.userInteractionEnabled = true
scrollView.exclusiveTouch = true
scrollView.canCancelContentTouches = true
scrollView.delaysContentTouches = true
</code></pre>

<p>and I finally tried to create a subclass of UIScrollView and I ended up with this:</p>

<pre><code>class myScrollView: UIScrollView {

    override func touchesShouldCancelInContentView(view: UIView) -&gt; Bool {
        return false
    }
}
</code></pre>

<p>but still the button is not active whenever there is any scrolling.</p>

<p>How can I fix that?</p>