我如何检查每个出口实际上都指向某个视图?
我如何检查每个出口实际上都指向某个视图? 如何在 Interface Builder 中手动设置对象的索引? 我们在上一个主题中讨论了 当我正在获取子视图的索引
我检查了我的插座
How can I check that every outlet actually points to some view ?
How can I manually set the index of the object in Interface Builder ?
we discussed in previous topic There is a problem when i am getting index of subview
i checked my outlet
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果为零,则表示未正确附加。即
,但是,仅仅因为连接了插座并不意味着它绝对是任何东西的子视图:)
如果您收到内存不足警告,那么您的控制器将释放其所有视图。这会将它们从 ui 中删除,但不会从插座中删除它们,除非您告诉它:)
完全有可能出现 distanceTextField 不为 nil 但 distanceTextField.superview 为 nil 的情况。
另外,仅仅因为您创建了一个控制器并不意味着它已经创建了所有视图 - 它会等到最后一刻才创建它们以节省内存/加速加载等。
在 viewDidLoad 之前,您的出口将为零已在您的控制器内部调用。
If it's nil it's not correctly attached. i.e.
However, just because an outlet is attached doesn't mean that it's definitely a subview of anything :)
If you get a low memory warning then your controller will release all of it's views. This will remove them from the ui but won't remove them from the outlet unless you tell it to :)
It's perfectly possible to get the situation where distanceTextField is not nil but distanceTextField.superview is nil.
Also, just because you have created a controller doesn't mean that it's created all of it's views yet - it will wait until the last minute to create them to save memory / speed up loading etc.
You will get nil for your outlets until viewDidLoad has been called inside your controller.