UIScrollView 和 UIWebview 中的滚动条
我花了一段时间寻找这个问题的答案: 如何保持 UIScrollView 和 UIWebview 上的滚动条可见?这样用户就知道他可以向上或向下滚动。 (就像在火狐或任何其他浏览器中一样,所以无需先触摸滚动视图)
我在一些网站上读到这是不可能的,所以我的另一个问题是: 有没有办法向滚动视图或网页视图添加“滚动条”?
非常感谢
I've been searching for some time for an answer on this problem:
How can I keep the scrollbars on my UIScrollView and UIWebview visible? So that the user knows he can scroll up or down. (like in firefox or any other browser so without touching the scrollvie first)
I read on some sites that it wasn't possible, so my other question would be:
Is there a way to add a "scrollbar" to a scrollview or webview?
Thank you very much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许你可以用这个:
flashScrollIndicators
不会一直显示滚动条,只是在视图加载时闪烁。
编辑:其他解决方案:
在您的视图加载时,您可以像这样创建 webview 的滚动视图:
UIScrollview *scrollview = [webview.subviews objectAtindex:0];
您必须在自身上设置滚动视图的委托:
.scrollview.delegate= self
在您添加的 .h 文件中
当您放入 .m 文件时,您可以使用:
-(void)ScrollviewDidscroll:...
(我不知道当你有多个滚动视图时它是否有效)
Maybe you could use this:
flashScrollIndicators
It won't show the scrollbar all the time, but it just flashes when the view is loaded.
Edited: Other solution:
In your view didload, you make a scrollview of you webview like this:
UIScrollview *scrollview = [webview.subviews objectAtindex:0];
you have to set the delegate of the scrollview on self:
scrollview.delegate= self
in your .h file you add
When you place in your .m file you can use:
-(void)ScrollviewDidscroll:...
(I don't know if it works when you have multiple scrollviews)
是的,您可以尝试在滚动条顶部添加自定义视图(可以是图像视图)。您必须监视
contentOffset
和contentSize
才能知道您所在的位置。根据此信息,您可以定位自定义滚动条。Yes you can try adding a custom view ( can be image view) on top the scrollbar. You will have to monitor the
contentOffset
andcontentSize
to know where you are. Based on this information, you can position your custom scroll bars.