0

我注意到我的应用程序有一个奇怪的问题,该问题只出现在 iPhone 3G 和 iPhone 3GS 上。我正在创建一个包含两页的滚动视图。在滚动的第二页上,当您尝试滚动选择器时,它非常无响应。看起来我的应用程序无法区分选择器的滚动和滚动视图的滚动,因为有时您向上滚动它会向左移动。

请记住,这在 iPhone 4 和 iPhone 4S 上效果很好。

以前有没有人遇到过这个问题,或者对实际发生的事情有任何想法?

4

3 回答 3

1

显然 UIScrollView 和 UIPickerView 如果一起使用会导致问题。但是,这只发生在 iPhone 3 和 iPhone 3GS 上。

解决方案是继承 UIScrollView 并实现以下方法。

- (UIView *)hitTest:(CGPoint)point 
         withEvent:(UIEvent *)event
{
    UIView *result = [super hitTest:point withEvent:event];

    if ([result.superview isKindOfClass:[UIPickerView class]]) {
        self.canCancelContentTouches = NO;  
        self.delaysContentTouches = NO;
    }
    else {
        self.canCancelContentTouches = YES;
        self.delaysContentTouches = YES;
    }
    return result;
}
于 2012-04-23T23:33:35.817 回答
0

在滚动视图上添加 UIView,在 UIView 上添加 UIPickerView。

于 2012-04-23T15:24:26.247 回答
0

您应该只在构建设置中启用 armv7(而不是 armv6),仅此而已

于 2012-04-23T15:23:16.703 回答