UITableView contentOffSet is not working properly

前端 未结 15 1831
滥情空心
滥情空心 2020-12-14 01:48

In viewWillAppear, I have added UISearchBar as my headerview of UITableView. When view loads, I hides UISearchbar under <

15条回答
  •  孤街浪徒
    2020-12-14 02:12

    I fixed it with layoutIfNeeded()

        self.articlesCollectionView.reloadData()
        self.articlesCollectionView.layoutIfNeeded()
        self.articlesCollectionView.setContentOffset(CGPoint(x: 0, y: 40), animated: false)
    

提交回复
热议问题