• 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: NSTableView [solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView [solved]


  • Subject: Re: NSTableView [solved]
  • From: Jeremy Dronfield <email@hidden>
  • Date: Mon, 23 Feb 2004 11:44:54 +0000

The "correct" place to tell your table view to reload its data is immediately after the data changes - i.e. when the array is first filled with objects, when an object is removed or added, or when the array is sorted. For example:

myTableData = [[NSMutableArray alloc] initWithObjects:foo, bar, ...etc];
[myTable reloadData];

and/or

[myTableData addObject:foo];
[myTable reloadData];

Clicking a button is certainly not correct (unless clicking the button alters the data in some way). The way I normally do it is to allocate an empty mutable array in -init. Then I have a method or set of methods responsible for maintaining the array - adding/removing objects, clearing it and rebuilding it with different data and so on. At the end of that method it will say [myTable reloadData]. I call this method in -awakeFromNib. I call it again whenever a user action causes the data to change.

- Jeremy

On 23 Feb 2004, at 10:22 am, Scott Little wrote:

David,

Uh, that is not exactly clear to me. I will probably be having this problem in the near future and I would like to understand how to solve it. What exactly is it that you learned?

Is it that loading in init and reloading in awakeFromNib is the right behavior or wrong, and if wrong what is the right behavior? Certainly not forcing the user to click on a manual reload button?

Thanks,

Scott

You and I, we reject these narrow attitudes
We add to each other, like a coral reef - Neil Peart, Rush
Building bridges on the ocean floor "Alien Shore"
Reaching for the alien shore
--
scott little
email@hidden

On 23 Feb, 2004, at 07:24, David Blanton wrote:

Original Post
---------------------------------------------------------------------- ----
Problem: NSTableView does not display scroll bars.

Archive says: This is a common problem. You must send a reloadData message
to the NSTableView for scroll bars to be displayed.

Result: The NSTableView is displayed with a scroll bar. It does get the
reloadData message as well as the setNeedsDisplay:YES message. There are
more rows in the table than can be displayed yet there is no knob in the
scroll bar.

Question: What the heck am I not doing?

Arrrgggg and thanks!

David Blanton
---------------------------------------------------------------------- ----
Solution
---------------------------------------------------------------------- ----
It was a matter of WHEN the reloadData message is sent. I was loading the
array in 'init' and and sending reloadData in 'awakeFromNib' because I
wanted everything ready when the view was displayed.

So I added a button 'Manual' and load the array and send reloadData when
clicked.

I learned something. Thanks to all.

DB
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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: NSTableView [solved]
      • From: Jerry Krinock <email@hidden>
References: 
 >NSTableView [solved] (From: David Blanton <email@hidden>)
 >Re: NSTableView [solved] (From: Scott Little <email@hidden>)

  • Prev by Date: Re: New to Objective-C/Cocoa Programming
  • Next by Date: Menu
  • Previous by thread: Re: NSTableView [solved]
  • Next by thread: Re: NSTableView [solved]
  • Index(es):
    • Date
    • Thread