将 IBAction 添加到 UIScrollView
嘿,我想知道是否可以将 IBActions 添加到 UIScrollView 中?那么当用户滚动到下一张图像时,IBAction 就完成了?
这可能吗?
Hey, I was wondering if it would be possible to add IBActions to a UIScrollView? So when the user has scrolled to the next image an IBAction is done?
Would this be possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须实现 UIScrollViewDelegate 协议 并实现
-scrollViewDidScroll:
方法。在该方法中,您可以使用 UIScrollView 的 contentOffset 属性来确定当前滚动位置,并从那里找出它滚动到的图像。You would have to implement the UIScrollViewDelegate protocol and implement the
-scrollViewDidScroll:
method. In that method, you could useUIScrollView
'scontentOffset
property to determine the current scroll position, and from there figure out what image it has scrolled to.