• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArrayController selection bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController selection bug?


  • Subject: Re: NSArrayController selection bug?
  • From: Henrik Wittland <email@hidden>
  • Date: Wed, 12 Nov 2003 00:09:05 +0100

Am 11.11.2003 um 21:54 schrieb Jesse Grosjean:

Thanks for all of your feedback.

But it breaks the separation between MODEL and VIEW in the MVC paradigma.

No, it does not. Both objects are controllers (recall Jesse's original method:
- (IBAction)modelRemove:(id)sender {
[...]
)

Actually the example that I posted was just a quick demo to show the bug. In my actual code these methods are all in my model objects and I don't have easy access to the NSArrayController.

As expected with a model which separates between Model,View and Controller.


But unfortunately I also don't really have a backing NSMutableArray behind the scenes that I can change to get around the bug by creating a new array. Instead the to-many mutable KVC methods are accessing a separate database layer, not a backing NSMutableArray.

Which database layer are you using?

I suppose that I could create an extra layer following the NSMutableArray protocol, but that's not a very appealing solution to me. If anyone has ideas on how to get around the issue please send them this way.


@implementation YourModelClass_or_YourModelRootClass (NSArrayControllerSelectionFixForBehindTheScenesObjectRemoval)
-(id)valueForKey:(NSString *)key {
id value = [super valueForKey:key];
if ([value isKindOfClass:[NSArray class]]) {
return [NSArray arrayWithArray:(NSArray *)value];
} else {
return value;
}
}
@end
You can easily remove this category after the problem gets fixed. Apple teaches us to not overwrite valueForKey: but this is a workaround.

Has anyone out there started work in a generic NSOutlineViewController? I understand that it couldn't be used to bind the the NSOutlineView in interface building, but it would making writing the NSOutlineViews datasource and delegate much easier I think. I think I may just try to follow NSArrayControllers basic design, but fix it so that it works with my code (and probably introduce many other bugs in the process) and also make it work with outline views.

It appears that there is indeed a bug here -- if you haven't already, Jesse would you please report it?

Yeah I'll send this one in.

Thanks for everyone's help.

Jesse
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSArrayController selection bug?
      • From: Scott Anguish <email@hidden>
References: 
 >NSArrayController selection bug? (From: Jesse Grosjean <email@hidden>)
 >Re: NSArrayController selection bug? (From: mmalcolm crawford <email@hidden>)
 >Re: NSArrayController selection bug? (From: Jesse Grosjean <email@hidden>)
 >Re: NSArrayController selection bug? (From: mmalcolm crawford <email@hidden>)
 >Re: NSArrayController selection bug? (From: Henrik Wittland <email@hidden>)
 >Re: NSArrayController selection bug? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: itunes for windows HOWTO ???
  • Next by Date: Installing XCode and PB in parallel
  • Previous by thread: Re: NSArrayController selection bug?
  • Next by thread: Re: NSArrayController selection bug?
  • Index(es):
    • Date
    • Thread