in Xcode 3.1.2 I used to load nib NSCollectionViewItemin my subclass NSCollectionViewItemas follows:
-(id)copyWithZone:(NSZone *)zone
{
id result = [super copyWithZone:zone];
[NSBundle loadNibNamed:@"PersonView" owner:result];
return result;
}
In Xcode 3.2 under 10.6, the same method is not inferior to the error, but it does not load the view into NSCollectionView.
Is there anything else that needs to be done to show the performance? Or is there even an even better way to do this, what happens when a superclass is replaced NSCollectionItemwith NSViewController?
In the end, overriding copyWithZoneto achieve this standard functionality has always seemed to me a hack. I think you need to be able to specify the tip that should be used in IB, but it seems like Apple doesn't think so.
I looked at an example that is available in the documentation, but there it NSCollectionViewItemis created programmatically using initWithNibName, but I would like to create it in IB.
UPDATE
I did what kperryua suggested, but now I cannot access the exits from NSCollectionViewItem. Here is what I am trying to do:
- (void)setRepresentedObject:(id)object {
if (object) {
[labelName setValue:[object name]];
}
}
I linked the tag name to the owner of the file, which is mine NSCollectionViewItem. This works fine in 10.5, but now no output has been assigned (I checked this with GDB).
image showing bindings http://img21.imageshack.us/img21/671/picya.png
UPDATE 2 :
I also bound NSCollectionView itemPrototypeto my subclass NSCollectionViewItem(PersonController).
image showing bindings http://img503.imageshack.us/img503/4672/pic2d.png
Now File Owner PersonView.niband itemPrototype NSCollectionViewpoint to my subclass.
, http://img340.imageshack.us/img340/6184/pic3.png
, , , labelName .
, , , "".
, ?
.