有没有办法让XIB仅使用单元的一部分?

问题描述

当前,我们有一个XIB可以通过以下操作实例化:

 override func viewDidLoad() {
        super.viewDidLoad()
        tableView.register(UINib(nibName: "CustomCell",bundle: nil),forCellReuseIdentifier: "CustomCell")
    }

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

问题是xib仅代表卡的内部,每张卡将具有不同的背景(xib除外),需要根据场景进行更改。基本上,我们需要自定义xib周围的空间,以使每个单元格具有不同的背景图像。有没有办法为每个单元格加载xib,但单元格中xib周围仍然有空间来更改单元格的背景?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)