Dear All,

I am developing an Cocoa application using a NSTreeView, bound to a 
NSTreeController.
The application is build around a master-detail structure, with an 
NSOutlineView on the left side and a NSTableView on the right side (similar to 
iTunes)

I would like to remove all elements from the detail table when the user changes 
selection in the Outline View before adding new elements, fair enough :-) ?

I am using the following code to remove all elements from the table :

[[arrayController mutableArrayValueForKey:@"arrangedObjects"] removeAllObjects];

which causes the following exception :

2009-11-26 14:24:39.964 iDream[61907:5937] -[_NSControllerArrayProxy 
removeObjectAtIndex:]: unrecognized selector sent to instance 0x20006d9a0
2009-11-26 14:24:39.965 iDream[61907:5937] *** Terminating app due to uncaught 
exception 'NSInvalidArgumentException', reason: '-[_NSControllerArrayProxy 
removeObjectAtIndex:]: unrecognized selector sent to instance 0x20006d9a0'
*** Call stack at first throw:
(
        0   CoreFoundation                      0x00007fff82e51444 
__exceptionPreprocess + 180
        1   libobjc.A.dylib                     0x00007fff830a30f3 
objc_exception_throw + 45
        2   CoreFoundation                      0x00007fff82eaa1c0 
+[NSObject(NSObject) doesNotRecognizeSelector:] + 0
        3   CoreFoundation                      0x00007fff82e2408f 
___forwarding___ + 751
        4   CoreFoundation                      0x00007fff82e201d8 
_CF_forwarding_prep_0 + 232
        5   CoreFoundation                      0x00007fff82e5db2e 
-[NSMutableArray removeAllObjects] + 62
        6   iDream                              0x0000000100002134 
-[ChannelsViewController emptyTable] + 80
        7   iDream                              0x00000001000023b3 
-[ChannelsViewController hasNewSelection:] + 45
        8   Foundation                          0x00007fff83e63e99 
__NSThread__main__ + 1429
        9   libSystem.B.dylib                   0x00007fff86f7ff8e 
_pthread_start + 331
        10  libSystem.B.dylib                   0x00007fff86f7fe41 thread_start 
+ 13
)
terminate called after throwing an instance of 'NSException'


I search on Google, StackOverflow and many others but can't figure out how to 
do this.  Any help appreciated !

Thanks

--Seb




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to