gpt4 book ai didi

ios - 如何将 UICollectionViewCell 嵌套在另一个 UICollectionViewCell 中?

转载 作者:行者123 更新时间:2023-11-30 11:10:44 25 4
gpt4 key购买 nike

按照我的老问题here : How to add UIView inside a UITableViewCell Programmatically?

我想通过在这些 collectionViewCell 卡中添加更多元素来实现类似于 iOS 11 Today 选项卡的增强 View 。

我想在我的 CollectionViewCell 卡(App Store Today 选项卡单元格)中添加像 Netflix 或其他 AppStore 选项卡一样的双向滚动(游戏和应用程序)。这是我想要的概述: enter image description here

请告诉我是否有可能实现这样的目标。如果是的话怎么办?谢谢。

最佳答案

import Foundation
import UIKit

class ObjCell: UICollectionViewCell{

let leftView: UIView = {
let view: UIView = UIView()
view.backgroundColor = UIColor.red
view.frame = CGRect(x:20, y:50, width:320, height:50)
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()

override init(frame: CGRect) {
super.init(frame: frame)

setCellUI()
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func setCellUI(){

backgroundColor = UIColor.yellow
addSubview(leftView)
}
}

关于ios - 如何将 UICollectionViewCell 嵌套在另一个 UICollectionViewCell 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52202237/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com