Cocoa: Disappearing headers in CoreData generated TableViews

Apple, Cocoa, General

Apple Cocoa developers: Finally another blog entry for you!
Everyone else: You may want to skip this one…

It has come to my attention that some NSTableView instances created by dragging CoreData objects into Interface Builder will not work quite right. Specifically, if you add one more row from a case like this:

Core Data Tableview2

you will sometimes see the header disappear:

Core Data Tableview2A

Looking at the NSTableView in IB reveals that it has an offset frame location, which you cannot change:

Core Data Tableview Inib

The solution is to add an outlet to the NSTableView inside your controller and add a bit of code to correct the situation:

- (void)awakeFromNib {
   [tableView setFrameOrigin:NSZeroPoint];
}

This relates to MacOS 10.4 Tiger.



Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

Subscribe to new posts:

You'll get an email whenever a I publish a new post to my blog and nothing more. -- Corbin

As an Amazon Associate I earn from qualifying purchases.

(c) 2008-2024 Corbin Dunn

Privacy Policy

Subscribe to RSS feeds for entries.

63 queries. 0.206 seconds.

Log in