没有 Core Data 的 NSArrayController 绑定
我有一个 NSArrayController,我希望其内容成为所有连接屏幕的 CGDirectDisplayID 的列表。现在我有以下代码:
NSArray* screens = [NSScreen screens];
for (NSScreen* screen in screens)
{
NSNumber* screenId = (NSNumber*)[[screen deviceDescription] valueForKey:@"NSScreenNumber"];
[displaysList addObject:screenId];
}
[displaysArrayController setContent:displaysList];
displaysList是一个NSMutable数组,它在awakeFromNib中分配,我需要在界面生成器中做什么来使用displaysList中的值填充弹出按钮代码>?
I have an NSArrayController, the content of which I would like to be a list of the CGDirectDisplayID
s of all of the connected Screens. Right now I have the following code:
NSArray* screens = [NSScreen screens];
for (NSScreen* screen in screens)
{
NSNumber* screenId = (NSNumber*)[[screen deviceDescription] valueForKey:@"NSScreenNumber"];
[displaysList addObject:screenId];
}
[displaysArrayController setContent:displaysList];
displaysList is an NSMutable array which is allocated in awakeFromNib
, what do I need to do in interface builder to populate a popup button with the values in displaysList
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实例 DisplaysArray
将其模式设置为“NSArray”
禁用检查“准备内容”
将其绑定到具有 DisplayArray 属性的对象。将模型关键路径设置为
显示数组。
我希望这有帮助:)
instance displaysArray
Set its mode to "NSArray"
Disable the check "Prepares Content"
bind it to the object with the property displaysArray. Set the model key path to
displaysArray.
I hope that helps :)