2011-01-23 3 views
0

핀치 제스처가 끝날 때 작업을 수행 할 scrollView가 있습니다.PinchGesture 끝을 scrollView에서 검색합니다.

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; 
} 
관련 문제