开发者

NSTableView guarantee data display

The main GUI of my ap开发者_JAVA百科p has a NSTableView, controlled by its own controller class. This class loads data into the table once by launching and parsing the output of a process. This is done in the

-(void)awakeFromNib

method of the controller class. The table shows up right on startup, so it means that before the GUI is displayed, the parsing of the process output should be done.

Now the problem is that when the GUI is shown (my app startup is slow, which means that process has been launched), the table is sometimes empty or is sometimes loaded with data. This is random. So how do I get the table to be always loaded with data on startup?

reloadData does not work! and I also use [NSTask waitUntilExit];


This is how I often make an app "load completely" before the window shows:

Uncheck the "visible at startup" for your window in Interface Builder. Then create an IBOutlet NSWindow *window; in your AppDelegate. And finally, in your AppDelegate, implement the applicationDidFinishLaunching: method and add [window makeKeyAndOrderFront:self]; into this method.

This should work, because applicationDidFinishLaunching: will always be called after awakeFromNib.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜