IKImageBrowserView 绑定重复项
我将 IKImageBrowserView 的内容绑定到实现 IKImageBrowserItem 协议的对象 Person 的数组控制器:
– imageUID
– imageRepresentationType
– imageRepresentation
在 Person 类中,我希望属性“photo”与属性“imageRepresentation”相同(添加它只是为了符合协议)。
到目前为止,我的解决方案是在 Person init 方法中绑定 2 个属性。但是,我不喜欢有重复的属性,因为 Person 是一个模型类。
我应该怎么办 ? (请记住,我想保留名称 photo,而不是 imageRepresentation)
I binded the content of an IKImageBrowserView to an array controller of objects Person implementing the IKImageBrowserItem protocol:
– imageUID
– imageRepresentationType
– imageRepresentation
In the class Person, I want the attribute "photo" to be the same as the attribute "imageRepresentation" (that was added merely to conform to the protocol).
My solution so far is to bind the 2 attributes in the Person init method. However, I don't like to have duplicated attributes, since Person is a model class.
What should I do ? (keeping in mind that I want to preserve the name photo, and not imageRepresentation)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于
imageRepresentation
对于协议来说是强制性的,但是您想要使用photo
属性,因此您可以通过以下方式实现该方法:通过这种方式,您实现了协议,但是您仅使用
照片
。Since
imageRepresentation
is mandatory for the protocol, but you want to use thephoto
property, you could implement the method in this way:In this way you fulfill the protocol, but you are using only
photo
.