• 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: programatically updating UI for NSArrayContoller/NSTableView combo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: programatically updating UI for NSArrayContoller/NSTableView combo


  • Subject: Re: programatically updating UI for NSArrayContoller/NSTableView combo
  • From: Russell Gray <email@hidden>
  • Date: Sun, 10 Jan 2010 21:54:03 +1100

I have tried modifying subscriptions (in the method openABPFeed:(NSURL*)feed), with the following:

[subscriptionsArrayController addObject: subscriptionInfo];
[[self mutableArrayValueForKey: @"subscriptions"] addObject: subscriptionInfo];
[[self mutableArrayValueForKey: @"subscriptions"] insertObject: subscriptionInfo atIndex: [subscriptions count]];
[subscriptionsArrayController insertObject: subscriptionInfo atArrangedObjectIndex: [[subscriptionsArrayController arrangedObjects] count]];

none of them worked?


you are correct about the following code:
> 		int i = 0;
> 		for (NSDictionary *child in subscriptionsArray)
> 		{
> 			NSDictionary* subscriptionsDictionary = [subscriptionsArray objectAtIndex:i];
> 			SubscriptionInfo* subscriptionInfo   = [[[SubscriptionInfo alloc] initWithInfoDictionary: subscriptionsDictionary] autorelease];
>
> 			[subscriptions addObject: subscriptionInfo];
> 			i++;
> 		}


I updated that. thanks. (Obj-C is my first programming language, so i am still getting my head around it....)

As for the two arrays:
subscriptions
subscriptionsArray

subscriptions is the mutable array that subscriptionsArrayContoller is bound to for its content.
and subscriptionsArray is a mutable array that I use to read/write my plist file. I did this because subscriptions would just return an array of pointers, and not the actual dictionaries contained within the array.(and i did not know of a way to get the dictionaries from the pointers to write to my plist file.) (like I said, still learning here, so maybe not the best approach)


Russell


On 10/01/2010, at 9:29 AM, mmalc Crawford wrote:

>
> On Jan 9, 2010, at 2:15 pm, Russell Gray wrote:
>
>> 	[subscriptionsArray addObject:output];
>>
> You haven't shown where you're modifying 'subscriptions' (apart from in the init method).
> Do you have two arrays that mirror each other, subscriptions and subscriptionsArray?
> Otherwise, if this is a typo (and it's helpful to see the code you're actually using...), then:
>
> On Jan 9, 2010, at 3:29 am, Quincey Morris wrote:
>> There are two ways you can update the "subscriptions" property KVO-compliantly:
>>
>
> you (Russell) still don't seem to have followed this advice...
>
>
>
> Some of the rest of the code seems somewhat confused.  For example:
>
> 		int i = 0;
> 		for (NSDictionary *child in subscriptionsArray)
> 		{
> 			NSDictionary* subscriptionsDictionary = [subscriptionsArray objectAtIndex:i];
> 			SubscriptionInfo* subscriptionInfo   = [[[SubscriptionInfo alloc] initWithInfoDictionary: subscriptionsDictionary] autorelease];
>
> 			[subscriptions addObject: subscriptionInfo];
> 			i++;
> 		}
>
> What is the point of the unused child iterator variable? Should your code not look more like:
>
> 		for (NSDictionary *child in subscriptionsArray)
> 		{
> 			SubscriptionInfo* subscriptionInfo   = [[SubscriptionInfo alloc] initWithInfoDictionary:child];
> 			[subscriptions addObject: subscriptionInfo];
> 			[subscriptionInfo release];
> 		}
>
>
>
> mmalc
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: programatically updating UI for NSArrayContoller/NSTableView combo
      • From: Quincey Morris <email@hidden>
References: 
 >programatically updating UI for NSArrayContoller/NSTableView combo (From: Russell Gray <email@hidden>)
 >Re: programatically updating UI for NSArrayContoller/NSTableView combo (From: mmalc Crawford <email@hidden>)
 >Re: programatically updating UI for NSArrayContoller/NSTableView combo (From: Russell Gray <email@hidden>)
 >Re: programatically updating UI for NSArrayContoller/NSTableView combo (From: Quincey Morris <email@hidden>)
 >Re: programatically updating UI for NSArrayContoller/NSTableView combo (From: Russell Gray <email@hidden>)
 >Re: programatically updating UI for NSArrayContoller/NSTableView combo (From: Quincey Morris <email@hidden>)
 >Re: programatically updating UI for NSArrayContoller/NSTableView combo (From: Russell Gray <email@hidden>)
 >Re: programatically updating UI for NSArrayContoller/NSTableView combo (From: mmalc Crawford <email@hidden>)
 >Re: programatically updating UI for NSArrayContoller/NSTableView combo (From: Russell Gray <email@hidden>)
 >Re: programatically updating UI for NSArrayContoller/NSTableView combo (From: mmalc Crawford <email@hidden>)

  • Prev by Date: Re: Enabling NSZombieEnabled programatically
  • Next by Date: Re: Enabling NSZombieEnabled programatically
  • Previous by thread: Re: programatically updating UI for NSArrayContoller/NSTableView combo
  • Next by thread: Re: programatically updating UI for NSArrayContoller/NSTableView combo
  • Index(es):
    • Date
    • Thread