Question

I am using a NSSearchField to run a query over the internet and display the results in a table view. Whilst the query is running I would like to display a progress indicator inside an NSSearchField? I think I have seen this done in another application before.

Is there an open source component that I could use to accomplish this?

How would I go about doing this? What is the best way? What are the pitfalls?

Was it helpful?

Solution

The easiest way is to put the progress indicator above (atop) the search field and leave them as separate views. It used to be that view z-ordering would give unpredictable results and weren't encouraged. That's not been true for several OS X versions, now, so if it looks good and behaves as expected, I say go for it.

The harder way would be to subclass NSSearchField and muck around according to the goodies found in the Control and Cell Programming Topics for Cocoa guide.

OTHER TIPS

I'd go for a custom subclass of UISearchFieldCell. Find the method that draws the background and try to add your custom drawing code there. I'd rather not fiddle with nested components. I think the one used in safari is also a custom control.

This is not my solution but I came across this question and I eventually found someone that worked out a solution and it worked for me:

https://github.com/owainhunt/UAShared/blob/master/UAShared/NSSearchField%2BSpinner.m

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top