您的位置:首页 > 产品设计 > UI/UE

含有按钮的ScrollView在iOS8中无法滚动的解决办法 | ScrollView with UIControl/UIButton subviews not scrollable under iOS 8

2014-10-19 12:11 633 查看
转自:http://zcw.me/blogwp/%E5%90%AB%E6%9C%89%E6%8C%89%E9%92%AE%E7%9A%84scrollview%E5%9C%A8ios8%E4%B8%AD%E6%97%A0%E6%B3%95%E6%BB%9A%E5%8A%A8%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95-scrollview-with-uicontroluibutton-subv/


这样设置就可以了:

Searched for a while and got this issue fixed by

scrollview.panGestureRecognizer.delaysTouchesBegan = YES;

—————————————————————
另外:

I found that in iOS 8, the UIScrollView's underlying UIPanGestureRecognizer is not respecting the UIScrollView's delaysContentTouches property. I consider this an iOS 8 bug. Here's my workaround:

[code]theScrollView.panGestureRecognizer.delaysTouchesBegan = theScrollView.delaysContentTouches
[/code]
And there's also another workaround (but I tried without lucky, cause UIControl instances not works then, let me know if u've any idea about it, thx):

[code]if (floor((NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1)) {
UITapGestureRecognizer * nothingTap = [[UITapGestureRecognizer alloc] init];
[nothingTap setDelaysTouchesBegan:YES];
[scrollView addGestureRecognizer:nothingTap];
}

再另外,还可以写一个继承UIScrollView的子类:
见http://stackoverflow.com/questions/25800325/ios-8-buttons-in-horizontal-scroll-view-intercepting-pan-event-scroll-does-n
[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐