UILabel 未分配,为 null - 为什么?

发布于 2024-10-19 14:59:04 字数 288 浏览 3 评论 0原文

我已经创建了 UIView,它在界面生成器中具有 UITableView 和 UILabel。它们连接到 IBOutlet 到相应的 UIView 类。

在 UIView 类中,我实现了 UITableViewDataSource 和 UITableViewDelegate。当调用这些方法时,这些委托可以正常工作。

但是,当我尝试在“viewDidLoad”方法中更新 UILabel 时,没有任何反应,因为未创建 UILabel - 调试器显示值 x0。

这里有什么问题?我需要做什么才能创建 UILabel?

I have created UIView which has UITableView and UILabel in the interface builder. They are connected to IBOutlets to the corresponding UIView class.

In UIView class i have implemented UITableViewDataSource and UITableViewDelegate.Those delegate works fine when those methods are called.

But, When I try to update the UILabel in the "viewDidLoad" method, nothing happens because the UILabel isn't getting created - the debugger shows a value of x0.

What the problem here? and what i need to do for UILabel to get created?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深居我梦 2024-10-26 14:59:04

如果可以看到您的表视图,则意味着您的 xib 文件加载正确。我唯一能想到的是你没有连接到界面生成器中的 UILabel,我建议你检查并重新连接它。

If your table view can be seen that that means your xib file loads correctly. The only thing that I can think of is that you did not have a connection to the UILabel in the interface builder, I would suggest you to check and reconnect it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文