我創建了一個UIViewController,它包含兩個View(頂部,底部), 底部視圖在單擊searchBar時一直展開到頂部。 (bottomView高度擴大,topView高度越來越小)。didSelectRowAt indexPath沒有被調用
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包含另一個按鈕以在需要時摺疊bottomView。
topTableViewCell包含兩個按鈕和兩個標籤。 bottomTableViewCell包含一個標籤和一個imageView。
問題是沒有一個tableViews單元調用didSelectRowAt。
要被代表設置什麼課? – CoderFrom94
到包含topView和bottomView的UIViewController。 –
你能提供更多的代碼嗎?我希望看到爲tableViews和didSelectRowAt方法聲明都設置了委託和數據源。 – CoderFrom94