UILabel 未分配,为 null - 为什么?
我已经创建了 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果可以看到您的表视图,则意味着您的 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.