Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个应用程序。我正在使用 UIScroll 视图。当我对该滚动视图执行触摸操作时,它将垂直滚动。但我需要使用顶部和底部按钮执行顶部滚动和底部滚动操作。所以请告诉我如何使用该按钮执行此滚动操作。
正如其他人所说,这不是真的推荐。不过,有可能...
对于“顶部”按钮,使用以下代码: [scrollView scrollRectToVisible:CGRectMake(0, 0, 320, 20) animated:YES];
[scrollView scrollRectToVisible:CGRectMake(0, 0, 320, 20) animated:YES];
考虑到滚动视图的高度,对“底部”按钮使用类似的方法。
而不是放置按钮并在这些按钮上添加滚动功能,只需使用动画向用户闪烁右/左指示图像,以便用户知道比当前页面更多的内容。