我来自Android,我在IOS中遇到了很多麻烦。我需要制作一个像电影学分一样的滚动菜单。我使用了下面的代码:
rol = scroll_view.contentOffset.y;
timer = [NSTimer scheduledTimerWithTimeInterval:.02 target:self selector:@selector(timer_rol) userInfo:nil repeats:YES];
-(void)timer_rol{
[scroll_view setContentOffset:CGPointMake(0,rol) animated:YES];
rol++;
}
此代码工作正常,但是当用户交互向上或向下滚动时,视图返回到之前的位置(rol 的值)。问题是,滚动后如何获取当前内容位置
我已经尝试过这些代码,但没有人工作:
CGPoint point = [scroll_view contentOffset];
rol = r.y +1;
-(void) handleGesture:(UIGestureRecognizer *) sender{}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {}
任何人都可以帮助我吗?