将 UIWebView 放入 UIScrollView 中的替代方法是什么
到目前为止,我已经让 UIWebView 在 UIScrollView 中工作了,而且我刚刚在苹果网站上看到不建议这样做。
那么好吧,还有什么选择呢?我需要显示网页,并且需要它们可滚动,这样如果用户向左滑动,就会从右侧出现一个完全不同的页面。向右滑动则相反。
如果不将 UIWebView 放入 UIScrollView 中,这是如何完成的?
谢谢。
I have gotten UIWebView inside UIScrollView to work, so far anyways, and I have just seen mention on Apple's site that doing so is not advised.
So OK, what's the alternative? I need to display web pages, and I need them to be scrollable, such that if the user swipes leftward then an entirely different page appears coming in from the right. And a reverse situation with swiping rightward.
How is that done without putting UIWebView inside UIScrollView?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,您需要
UIWebView
,它确实具有UIScrollView
的许多功能,不仅能够上下滚动,还能够左右滚动。此外,用两根手指滚动是不行的,因为网页中的可滚动元素(例如文本区域)只能用两根手指滚动。
三个手指也不太好,因为这对于手指粗的人来说不太方便...
所以我的建议是,您在
UIWebView
中添加一个UIGestureRecognizer
并寻找一个滑动手势。然后用动画来相应处理页面的切换。Well, you need the
UIWebView
, which has indeed many features of aUIScrollView
, to be able to scroll not only up and down, but also to left and right.Also, scrolling with two fingers is a no-go, for scrollable elements within a web page, such as
textarea
s can only be scrolled with two fingers.Three fingers is also not so good because that's not convenient for people with thick fingers...
So my suggestion is that you add a
UIGestureRecognizer
to yourUIWebView
and look out for a swipe gesture. Then handle the switching of pages accordingly with animations.