0

私は次の階層を持っています:

- UIView 1
  - UIScrollView 2
    - UIView 3
      - UIView 4
        - UIButton 5 

私の問題は、UIButtonをタッチダウンすると、UIButtonによって登録されるまでに長い時間(1秒など)のように見える時間を押す必要があることです。

この階層の作成方法:UIView1は2と3が埋め込まれたnibファイルからロードされますが、4は別のnibファイルから作成され、最初にここに示されていない1つのビューに配置され、次にaddsubviewを使用して3に取り込まれます。(これが適切かどうかはわかりません)。

誰かがこの遅延を修正する方法について何か考えを持っていますか?この問題は、iOS 6のシミュレータではなく、ios5.1の4で発生します。

4

2 に答える 2

1

UIScrollViewdelaysContentTouchesプロパティをNOに設定してみてください。

また

[button PerformSelector:@selector(buttonClickMethod :) afterDelay:0.0]を使用してみてください。

于 2012-10-04T12:22:35.727 に答える
0
@interface CustomScrollView : UIScrollView {

}

@end

@implementation CustomScrollView


- (id)initWithFrame:(CGRect)frame {
    if ((self = [super initWithFrame:frame])) {
        // Initialization code
    }
    return self;
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    [[self superview] touchesEnded:touches withEvent:event];
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    [[self superview] touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

    [[self superview] touchesMoved:touches withEvent:event];

}

- (void)dealloc {
    [super dealloc];
}


@end

uiscrollviewの代わりにcustomscrollviewを使用する

于 2012-10-04T12:11:01.977 に答える