如何使 UIView 功能像 UIScrollView (Objective-C) [英] How to make the UIView function like UIScrollView (Objective-C)

查看:21
本文介绍了如何使 UIView 功能像 UIScrollView (Objective-C)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为主题的类.在该主题中,我可以创建(和删除)消息.我需要在可以向右或向左滚动/滑动的视图中显示消息(向右显示较旧的消息,向左显示较新的消息).想象一个可以在 ScrollView 中横向滚动的图像集合,它应该是什么样子.由于消息是由用户添加的,我无法使用 UIImage.我正在考虑我需要添加使用 UIView 而不是 ScrollView 的方法,现在我的问题是如何制作我的 UIView 功能在显示数据方面作为 ScrollView ?

I have a class named Topic. And inside that topic I can create (and delete) Messages. I need to show the messages in a view that can be scrolled/swiped either right or left (Right to show the older messages, and left to go back to the newer messages). Imagine an image collection that can be scrolled sideways in a ScrollView, that how this should look like. Since the messages is being add by the user, I can't use UIImage. I am thinking of the approach that I need to add use UIView instead of a ScrollView, now my problem is how can I make my UIView function as a ScrollView in terms of displaying data?

请帮忙.谢谢.

推荐答案

你应该使用手势识别.检查用户是向左滑动还是向右滑动.在确定您可以使用动画更改 UIView 之后.我希望你能得到我.这可能对您有用.

You should have to use gesture recognition. Check that user is swiping left or swiping right. after Identifying that you can change UIView with animation. I hope you can get me. This can be useful to you.

这篇关于如何使 UIView 功能像 UIScrollView (Objective-C)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆