IBOutletCollection 和不同“种类”的多个对象没有按预期工作。谁知道为什么?
我尝试使用插座集合作为 Segue 过滤的基础,而不是标识符,但是当我将对象添加到插座集合(一般使用 id 定义;见下文)时,我发现只有 UI 元素或其他非 ui 元素是实际上不是两者都添加到集合中。让我澄清一下,IB 似乎可以让您将对象添加到集合中。假设添加一个按钮和一个标签,然后添加一个手势识别器。这在 IB 中有效,不会出现错误或警告,但在运行时查询时,该集合仅包含 UI 类型元素。手势识别器无处可寻,但仅添加手势识别器,它将出现在集合中。有谁知道为什么?
@property(强,非原子)IBOutletCollection(id) NSArray *myCollection;
I'm trying to use an outlet colleciton as a basis for segue filtering instead of Identifier, but when I add objects to the outlet collection (defined generically using id; see below), I find only UI elements OR other non-ui elements are actually added to the collection not both. Let me be clear, IB lets you seemingly add the objects to the collection. Say add a button and a label then a gesture recognizer. This works in IB without error or warning, but when queryed at runtime, the collection contains only the UI type elements. The gesture recognizer is nowhere to be found, but add only the gesture recognizer and it will be present in the collection. Does anyone know why?
@property (strong, nonatomic) IBOutletCollection(id) NSArray *myCollection;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论