带有UIControl / UIButton子视图的ScrollView / TableView在iOS 8下不可滚动

时间:2014-09-24 04:28:36

标签: ios uitableview uiscrollview ios8 uicontrol

我有一个UIScrollView实例(scrollview),以及作为子视图位于scrollview上的许多UIControl实例。一切都在iOS 8之前运行良好,但{8}现在在iOS 8下无法滚动。

似乎UIControl实例吃了触摸事件,而scrollview的{​​{1}}在iOS 8下被破坏了。


刚刚发现UITableView也有这个问题。

1 个答案:

答案 0 :(得分:8)

搜索了一段时间,并通过

解决了这个问题
scrollview.panGestureRecognizer.delaysTouchesBegan = YES;

还有另一种解决方法(但我没试过就试过,因为UIControl实例不起作用,请告诉我你是否对它有任何想法,thx):

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