Re: TableView not loading completely
Re: TableView not loading completely
- Subject: Re: TableView not loading completely
- From: deepak gopal <email@hidden>
- Date: Wed, 17 Oct 2007 23:19:46 +0530 (IST)
I intialize my plistArray in my init.
plistArray_ = [[NSMutableArray alloc] init];
I used removeAllObjects & arrayByAddingObjectsFromArray because I plan to reload the same dataSource multiple times based on the selections of my PopUpButton.
But yes setArray would be better.
Thank you
DG
----- Original Message ----
From: Adam R. Maxwell <email@hidden>
To: Corbin Dunn <email@hidden>
Cc: cocoa dev <email@hidden>; deepak gopal <email@hidden>
Sent: Wednesday, 17 October, 2007 9:26:23 AM
Subject: Re: TableView not loading completely
On Wednesday, October 17, 2007, at 09:20AM, "Corbin Dunn"
<email@hidden> wrote:
>
>On Oct 16, 2007, at 7:24 PM, deepak gopal wrote:
>
>> Hi
>>
>> I caught my mistake.
>>
>> Before I was doing this:
>> - (IBAction) loadTable {
>> NSDictionary *plistDictionary =
>> [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
>> plistArray_ = [plistDictionary valueForKey:@"Functions"];
>> }
>>
>> But my Dictionary died when I exited the method so all I had to do
>> is this
>> - (IBAction) loadTable {
>> NSDictionary *plistDictionary =
>> [NSDictionary dictionaryWithContentsOfFile:menuItemSelected];
>> [plistArray_ removeAllObjects];
>> [plistArray_ arrayByAddingObjectsFromArray:[plistDictionary
>> valueForKey:@"Functions"]];
>> }
>>
>
>
>You are modifying the datasource without calling "reloadData" on the
>table. you should have a [tableView reloadData] at the end of that
>loadTable method.
In addition, arrayByAddingObjectsFromArray: shouldn't be modifying the
plistArray_ variable. It's returning a new instance of NSArray, and
you're ignoring it, so I don't see how this could work. You may want to
just use [plistArray_ setArray:[plistDictionary
valueForKey:@"Functions"]] and save the removeAllObjects step.
--
adam
_______________________________________________
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
Save all your chat conversations. Find them online at http://in.messenger.yahoo.com/webmessengerpromo.php
_______________________________________________
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