当用户触摸屏幕时,我想向下滚动屏幕。我在我的 vc 中实现了 touchesBegan:withEvent: 方法,这就是我想出的。
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UIScrollView *scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0,0,self.view.frame.size.width, self.view.frame.size.height)];
scrollView.contentSize=CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:scrollView];
[scrollView scrollRectToVisible:CGRectMake(0,100,self.view.frame.size.width,self.view.frame.size.height) animated:YES];
}