UIScrollView中的iOS 5 UIButtons无法点击

Pau*_*aul 1 iphone objective-c uibutton uiscrollview ios

我有一个奇怪的错误,UIView中的两个UIButton,在UIScrollView视图中,在iOS 5上无法点击,但在iOS 6上工作得很好(屏幕截图显示下面的滚动条和地图)

唯一的另一个细节是滚动视图"向上滑动"以在选择工作站时显示按钮.我已经尝试过选择iOS 5上的按钮了,它们确实受到了打击(视觉上),但事件没有被触发.

编辑:如果我点击并按住模拟器中的按钮,然后将光标向上移动并释放(例如,对于始终可见的UIView部分),事件将触发.

滚动样本

滚动视图本身具有以下设置,后两者只被以试图使按钮在iOS 5中加入工作(尝试各种组合):

self.scrollView.clipsToBounds = YES;
self.scrollView.scrollEnabled = YES;
self.scrollView.pagingEnabled = YES;
self.scrollView.delaysContentTouches = NO;
self.scrollView.canCancelContentTouches = NO;
Run Code Online (Sandbox Code Playgroud)

按钮事件都正确连接,有适当的目标等:

[_updatePriceButton addTarget:self action:@selector(showPriceUpdateBoxWithPrice:) forControlEvents:UIControlEventTouchUpInside];
[_stationDetailsButton addTarget:self action:@selector(stationDetailsSelected:) forControlEvents:UIControlEventTouchUpInside];
Run Code Online (Sandbox Code Playgroud)

和处理程序(这里是一个作为样本):

- (void)stationDetailsSelected:(id)sender {
    if ([self.delegate respondsToSelector:@selector(stationDetailsSelected:)]) {
        [self.delegate stationDetailsSelected:_station];
    }
}
Run Code Online (Sandbox Code Playgroud)

任何帮助都会很棒!

Pau*_*aul 6

找到了罪魁祸首 - UIBut上的UITutGestureRecognizer配置错误:UIBut:

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(stationInfoViewTapped:)];
[infoController.view addGestureRecognizer:tap];
Run Code Online (Sandbox Code Playgroud)

在初始化'tap'之后添加以下内容可以解决iOS 5中的问题:

[tap setCancelsTouchesInView:NO];
Run Code Online (Sandbox Code Playgroud)