gpt4 book ai didi

ios - 在具有多个 View 的 XIB 中为 UITableViewCell 注册 Nib

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:07:49 24 4
gpt4 key购买 nike

我已经成功地使用 registerNib 在 XIB 中定义了一个 UITableViewCell 的 UI,其中只有一个 UITableViewCell 原型(prototype)。

为了封装,是否有可能拥有一个包含多个 UITableViewCell 的 XIB,并且仍然能够使用 registerNib 加载正确的单元格?

如果是这样,如何在代码中识别 XIB 中所需的单元原型(prototype)?

我目前在 tableView 的 VDL 中执行此操作,效果很好:

[self.tableView registerNib:[UINib nibWithNibName:@"LogoCell" bundle:[NSBundle mainBundle]]
forCellReuseIdentifier:CellId];

有没有办法指定我们要使用 XIB 中的哪个单元格原型(prototype)?

提前致谢。

最佳答案

In the interest of encapsulation, would it be possible to have an XIB with more than one UITableViewCell in it and still be able to load the proper cell using registerNib?

没有。

关于ios - 在具有多个 View 的 XIB 中为 UITableViewCell 注册 Nib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24704676/

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