开发者

Force NSBrowser to reload

开发者 https://www.devze.com 2023-02-25 21:18 出处:网络
I\'m new to Cocoa so apologies if this doesn\'t make sense. I\'m using an NSBrowser to get a Finder-style column view of some data from a web service.

I'm new to Cocoa so apologies if this doesn't make sense.

I'm using an NSBrowser to get a Finder-style column view of some data from a web service. The NSURLConnection result is returned asynchronously.

My issue is that the browser correctly calls its delegate to populate columns when the app starts, but I can't make it reload once I've got th开发者_如何学Goe data.

I've tried reloadDataForRowIndexes, noteHeightOfRowsWithIndexesChanged, addColumn, reloadColumn and loadColumnZero, but none of them trigger the browser to call numberOfRowsInColumn on the delegate as I would expect (and see on startup).

I know the browser delegate is ok because I can see it being called at startup.

Is there another way to ask the browser to refresh, or do I need to try another approach?

Plan B would be to fire the urlConnection off on another thread, and block the browser. I'm not keen on blocking the UI thread as I fear this will cause a beachball.

Plan C maybe would be to delay the browser loading from the nib file until the data was ready, but I'd have a similar issue next node unless I load all nodes a column early in anticipation.


[browser reloadColumn:0] did not work for me but [browser loadColumnZero].


[browser reloadColumn:0] is the right way to go. This just works, no workaround needed. Your error is elsewhere if this does not work for you.

0

精彩评论

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

关注公众号