Ok, so I do have subscriptions, and subscriptionsArrayContoller set up as you 
say - I should have mentioned that.
I also have the arrayController "Prepares Content" option checked in Interface 
Builder.

I tried all those options you provided. none worked, I still have the same 
result, the tableView will not update until something is changed via the UI.

can the XIB become corrupted somehow?






On 09/01/2010, at 10:29 PM, Quincey Morris wrote:

> On Jan 9, 2010, at 00:19, Russell Gray wrote:
> 
>> OK, so i checked out the link, and tried the following calls:
>> 
>> [subscriptions insertObject:subscriptionInfo atIndex:[subscriptions count]];
>> 
>> that didn't work, so I tried the following:
>> 
>> [subscriptionsArrayController willChangeValueForKey:@"subscriptions"];
>> [subscriptions insertObject:subscriptionInfo atIndex:[subscriptions count]];
>> [subscriptionsArrayController didChangeValueForKey:@"subscriptions"];
>> 
>> still, no good, so I also tried:
>> 
>> [subscriptionsArrayController willChangeValueForKey:@"arrangedObjects"];
>> [subscriptions insertObject:subscriptionInfo atIndex:[subscriptions count]];
>> [subscriptionsArrayController didChangeValueForKey:@"arrangedObjects"];
>> 
>> Am I totally missing something here?
> 
> Well, flailing, anyway.
> 
> These code samples imply, but don't say, that 'subscriptions' is a 
> NSMutableArray instance variable in some data model object, and that 
> 'subscriptionsArrayController' is a NSArrayController whose "contentArray" is 
> bound to the "subscriptions" property in that data model object, which is 
> backed by the 'subscriptions' instance variable. (It would have been nice if 
> you had given us that information.) Assuming that ...
> 
> The problem in the first case is that property "subscriptions" is not being 
> updated KVO-compliantly.
> 
> The problem in the second case is that property "subscriptions" is not being 
> updated KVO-compliantly, and array controllers don't have a "subscriptions" 
> property.
> 
> The problem in the third case is that property "subscriptions" is not being 
> updated KVO-compliantly, and forcing a KVO notification of the array 
> controller's "arrangedObjects" property doesn't help, because property 
> "subscriptions" is not being updated KVO-compliantly.
> 
> Are you seeing a pattern here?
> 
> There are two ways you can update the "subscriptions" property 
> KVO-compliantly:
> 
> 1. [[self mutableArrayValueForKey: @"subscriptions"] insertObject: 
> subscriptionInfo atIndex: [subscriptions count]];
> 
> 2. [subscriptionsArrayController insertObject: subscriptionInfo 
> atArrangedObjectIndex: [[subscriptionsArrayController arrangedObjects] 
> count]];
> 
> These can be abbreviated to:
> 
> 1. [[self mutableArrayValueForKey: @"subscriptions"] addObject: 
> subscriptionInfo];
> 
> 2. [subscriptionsArrayController addObject: subscriptionInfo];
> 
> In the first case, you add the object via a mutable array proxy that provides 
> KVO compliance, and the array controller will notice accordingly. In the 
> second case, you add the object via the array controller, and it updates your 
> data model property KVO compliantly for you.
> 
> Note that you should really define a "subscriptions" property (using 
> @property/@synthesize), if you haven't already. However, it happens to work 
> without the defined property, because KVO looks for a same-named instance 
> variable if the property is missing.
> 
> Does that help?
> 
> 
> _______________________________________________
> 
> 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/sweetpproductions%40gmail.com
> 
> This email sent to sweetpproducti...@gmail.com

_______________________________________________

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