Using UIKit:
I've got a view that has multiple UIButton
, but I can only scroll the view up or down if I began my scroll touch event outside the UIButton
.
So how can I make it so that I can scroll my view, regardless if I start my touch event on a UIButton
?
If your view behaves like a scroll view, try solution as below It has been proposed here: https://stackoverflow.com/a/26292829/9191054 and it works!
class UIButtonScrollView: UIScrollView {
override func touchesShouldCancel(in view: UIView) -> Bool {
if view.isKind(of: UIButton.self) {
return true
}
return super.touchesShouldCancel(in: view)
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.