【发布时间】:2017-11-17 15:56:28
【问题描述】:
我创建了一个 UIViewController 包含两个视图(顶部,底部), 单击 searchBar 时,底部视图会一直扩展到顶部。 (bottomView高度扩大,topView高度变小)。
func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
self.expandBottomView()
return true
}
func expandBottomView() {
let heightToAdd = TopView.frame.height - numOfRequestsTitle.frame.height
RecomandFriendHeight.constant += heightToAdd
UIView.animate(withDuration: 0.5) {
self.view.layoutIfNeeded()
}
topTableView.isUserInteractionEnabled = false
}
两个视图都包含 TableViews(topTableView,BottomTableView)所有代表都设置了我检查过。 BottomView 包含另一个按钮,可在需要时折叠底部视图。
topTableViewCell 包含两个按钮和两个标签。 bottomTableViewCell 包含一个标签和一个 imageView。
【问题讨论】:
-
代表设置到什么类?
-
到包含topView和bottomView的UIViewController。
-
你能提供更多代码吗?我想看看为 tableViews 和 didSelectRowAt 方法声明设置的委托和数据源。
-
尝试使用以下技术进行调试: 1. 尝试捕获视图层次结构并检查 tableView 是否可点击。 2. 确保在需要时启用 userInteraction,因为您正在禁用它。
-
不是因为您实际上没有单击“单元格”而是单元格中的元素,它可能被标签或其他东西阻止了。调试视图层次结构
标签: ios iphone swift uitableview swift3