之后,tableView.reloadData()可见collectionView显示的第一行意外马上。
我在其单元格中构建了一个tableView包含collectionView,用户可以tableView像 Instagram 一样在每一个中滚动多个图像。我该如何解决?谢谢!
表视图数据源
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return photoRolls.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "tableViewCell", for: indexPath) as! HomeTableViewCell
if photoRolls.isEmpty {
return UITableViewCell()
}
let user: UserModel = users[indexPath.row]
let photoRoll: PhotoRoll = photoRolls[indexPath.row] //this Model contains post info: likes, comments etc.
let photoUrls: UrlStrings = urls[indexPath.row] //this Model contains a …Run Code Online (Sandbox Code Playgroud)