2013-04-03 57 views
0

我有一个UIWebview我正在使用SwipeGesture加载多个网址,我正在滑动到下一页。我在handleSwipeUpFrom方法使用此代码来做到这一点,iOS Swipe Gesture - 滑动的时间延迟

UISwipeGestureRecognizer* swipeUpGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeUpFrom:)]; 
swipeUpGestureRecognizer.direction = UISwipeGestureRecognizerDirectionUp; 

我加载下一个URL在我webview。 一切正常PERFECTLY。但是滑动速度很快。我希望做一些延迟到它,任何想法....

回答

1

它可能是一个有点混乱,但如果没有人有一个清晰的解决方案,试试这个:

- (void)handleSwipeUpFrom:(id)sender 
{ 
    [self performSelector:@selector(anotherMethod:) withObject:object afterDelay:1.0]; 
} 
+1

我同意。如果您想要延迟,请插入延迟。标准的做法是延迟性能:http://www.apeth.com/iOSBook/ch11.html#_delayed_performance – matt

+0

什么是对象..? –

+0

对象是如果您需要将任何信息传递到辅助方法(可能是方向)。如果需要,你的第二个方法看起来像:' - (void)anotherMethod:(id)object' 如果你不需要传递任何东西,你可以'withObject:nil' – joeByDesign