简体   繁体   English

如何从不同的 UIViewController 中的 UITableView 访问 UITableViewCell?

[英]How to access UITableViewCell from UITableView in different UIViewController?

I have very complex cell in UITableView within UIViewControllerA .我在UIViewControllerA中的UITableView有非常复杂的单元格。 Now I need to use the same cell within UITableView of UIViewControllerB .现在我需要在UIViewControllerB UITableView中使用相同的单元格。

  1. How to do this without copy and paste views from one scene to another?如何在不将视图从一个场景复制和粘贴到另一个场景的情况下做到这一点?
  2. Do not wanna use xib approach.不想使用xib方法。
  3. Is it related to registerNib:forCellReuseIdentifier ?它与registerNib:forCellReuseIdentifier相关吗?

You mentioned you don't want to use xib .你提到你不想使用xib Storyboards don't support this and therefore the last option you have is to construct your UITableViewCell in code.故事板不支持这一点,因此您的最后一个选择是在代码中构建您的UITableViewCell With the new Auto Layout anchors, it's not that bad.使用新的自动布局锚点,还不错。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM