冲突滚动scrollview和tableview [英] conflict scrolling scrollview and tableview

查看:36
本文介绍了冲突滚动scrollview和tableview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含一些元素的滚动视图(uiimage,webview,...)在滚动视图的底部添加 tableview(评论列表).问题:虽然tableview是scrollview的一部分,但是scrollview是分开滚动的,tableview是分开滚动的!

I have a scrollview that contain some element (uiimage, webview ,...) in buttom of scrollview add tableview (comments list). Problem: although tableview is part of scrollview, but scrollview scroll separate and tableview scrolling separate!

我想在 scrollview 结束时开始 tableview scrollview 滚动 tableview 和 tableview 滚动禁用.我用它的代码:

I want at the end of scrollview and start tableview scrollview scrolling tableview and tableview scroll disabled. I used it code:

斯威夫特:

override func intrinsicContentSize() -> CGSize {
    self.layoutIfNeeded()
    return CGSizeMake(UIViewNoIntrinsicMetric, contentSize.height)
}

目标 C:

-(CGSize)intrinsicContentSize{
[self layoutIfNeeded];
return CGSizeMake(UIViewNoIntrinsicMetric, contentSize.height)}

但不工作.

感谢帮助

推荐答案

发生这种情况是因为它是在滚动视图中包含表视图的行为.那应该发生.

That happens because it is the behavior of having a table view inside a scroll view. That should be happening.

解决方案: 销毁 scrollView,并实现一个带有标题视图的 tableView,希望标题视图是带有 uiimage、webview 等的视图...而 tableView 将是您的评论.这是实现您想要的最佳方式,也就是说,如果我理解您真正想要的东西.

Solution: Destroy the scrollView, and implement a tableView with a header view, wish that header view it will be the view with uiimage, webview etc... and the tableView it will be your comments. This is the best way of implementing what you want, that is if i understood right what you actually want.

向表格视图添加标题示例:

self.tableView.tableHeaderView = topView // where top view is the view wish contains your uimage, buttons etc...

这篇关于冲突滚动scrollview和tableview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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