2011-01-23 4 views
0

ピンチジェスチャーが終了したときにアクションを実行するscrollViewがあります。スクロールビューのPinchGesture ENDを検出します。

SampleController.h

@interface SampleController : UIViewController <UIPopoverControllerDelegate,UITableViewDelegate>{ 
    IBOutlet UIScrollView *mapScrollView; 
} 
@property (nonatomic, retain) IBOutlet UIScrollView *mapScrollView; 
@end 

SampleController.m

@implementation SampleController 

@synthesize mapScrollView; 

- (void)viewDidLoad { 
    [super viewDidLoad]; 

UIPinchGestureRecognizer *pinchRecognizer = 
    [[UIPinchGestureRecognizer alloc] 
    initWithTarget:self 
    action:@selector(handlePinchFrom:)]; 
    [mapScrollView addGestureRecognizer:pinchRecognizer]; 
    [pinchRecognizer release]; 
} 

- (void)handlePinchFrom:(UIPinchGestureRecognizer *)recognizer { 
    if(recognizer.state == UIGestureRecognizerStateEnded) 
     { 
      NSLog(@"handleTapEND"); 
     } 
    else 
    { 
     NSLog(@"zooming ..."); 
    } 
} 

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

@end 

私の問題は、次のとおりです。

私はpinchRecognizer そのブロックmapScrollViewのスクロールを持っていたとき。

ScrollViewのスクロールまたはズームの終了を検出する他の方法はありますか?スクロールやdraggが起こった場合

私は私のコントローラ上のタイマーを持っていたアクションを続行:

おかげで、

ブルーノ

答えて

0

は、私は解決策を見つけた

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    self.mapTimer = [[NSTimer 
          scheduledTimerWithTimeInterval:1.0f 
          target:self 
          selector:@selector(updateDisplay:) 
          userInfo:nil 
          repeats:YES] retain]; 
} 

- (void)updateDisplay:(NSTimer*)theTimer { 

    if(mapHasMoved) 
    { 
     NSLog(@"updateDisplay"); 
     [self updateProducts]; 
     mapHasMoved = FALSE; 
    } 
} 

- (void)endZoomingOrScrollingHandler{ 

    mapHasMoved = TRUE; 
} 
関連する問題