码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2014-10-19 12:57:04      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   os   ar   for   strong   sp   on   

转自: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/

 

origin:http://stackoverflow.com/questions/26008559/scrollview-with-uicontrol-uibutton-subviews-not-scrollable-under-ios-8

这样设置就可以了:

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:

theScrollView.panGestureRecognizer.delaysTouchesBegan = theScrollView.delaysContentTouches

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):

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

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

标签:blog   http   io   os   ar   for   strong   sp   on   

原文地址:http://www.cnblogs.com/wangpei/p/4034528.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!