清理与结构的绑定
我有一个模型类,对于它来说,拥有 NSSize 和 NSPoint 实例变量非常有意义。这很可爱。
我正在尝试为此对象创建一个编辑界面。我想绑定到 size.width
等等。这当然是行不通的。
解决这个问题最干净、最可可的解决方案是什么?当然,我可以为我使用的每个结构的各个成员编写单独的访问器,但似乎应该有更好的解决方案。
I have a model class for which it makes quite a lot of sense to have NSSize and NSPoint instance variables. This is lovely.
I'm trying to create an editing interface for this object. I'd like to bind to size.width
and whatnot. This, of course, doesn't work.
What's the cleanest, most Cocoa-y solution to this problem? Of course I could write separate accessors for the individual members of every struct I use, but it seems like there should be a better solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不必为所有成员创建单独的访问器,您只需为您关心的类型创建包装器,例如:
You don't have to create seperate accessors for all the members, you could just create wrappers for the types you care about, e.g.: