UITableViewCell在跨越UITableView边界大小后隐藏

时间:2018-01-11 06:59:59

标签: ios iphone swift

enter image description here
我有UITableviewUIView开始居中,我想将我的tableview移动到导航栏的顶部。所以我为我的tableview设置了clipsToBounds属性为false。当我的tableview在穿过我的tableview边界后向上滚动时,我的自定义单元格会自动消失。

是否可以避免隐藏UITableViewCell?

我还尝试将自定义单元格及其内容视图clipsToBounds属性设置为false。什么都行不通。 iPhone默认日历应用程序运行良好..我想要类似的功能。

// MARK: - UITableview Delegates
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 20
    }

    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }

    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 60
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    {
        let feedcell = tableView.dequeueReusableCell(withIdentifier: "customCell") as! customCell
        return feedcell
    }

1 个答案:

答案 0 :(得分:0)

UITableView重用单元格,因此滚动尽可能顺畅。因此,如果一个单元格离开TableView的边界,它将从TableView中删除,以便重新用于下一个出现的单元格。

您可以检查this以尝试让单元格滚动到半透明导航栏后面。