Table View Controller中的Collection View单元格(如Tinder消息选项卡)

问题描述 投票:0回答:1

这是我第一次使用Stack Overflow :)希望我能找到答案并提供我的知识。

我目前正在开发像Tinder或instagram风格的聊天应用程序来学习Swift。

如在Tinder上所见,您可以滑动水平匹配的用户

https://i.stack.imgur.com/dFUcM.jpg

我想构建几乎相同的设计。

在我的main.storyboard上,就像

TableViewController

   -collectionView

        -collectionViewCell
        -collectionViewFlowLayout

   -tableViewCell

        -contentView

像这样。

collectionView单元格用于匹配的用户,和tableviewCells用于打开的聊天室。

我已经完成了聊天室。

但是收集视图部分从不显示。我试图为此制作Extension.swift文件,并输入像

 extension TableViewController {


   class RequestCVCell: UICollectionViewCell {

    @IBOutlet weak var MatchedAvatar: UIImageView!
    @IBOutlet weak var MatchedName: UILabel!

   override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
   MatchedAvatar.layer.cornerRadius = 30
   MatchedAvatar.clipsToBounds = true

    }


    let horizontalView = UIView(backgroundColor: .blue)

          }
 }

我曾考虑过建立一个故事板,例如

ViewController

   -collectionView

        -collectionViewCell
        -collectionViewFlowLayout

   -tableView

        -contentView

我真的不知道为什么它不起作用。 :(有什么办法能让我像火种吗?

感谢阅读,对不起我的英语,缺乏解释。

ios swift tableview collectionview tinder
1个回答
0
投票

我已经在github上为您创建了一个示例项目https://github.com/manojaher88/CollectionViewInTableView

© www.soinside.com 2019 - 2024. All rights reserved.