" I think I mumbled some lame excuse about not doing it, namely that it was more confusing than I could easily figure out, but damn it, who needs drag and drop anyway?Well, previous antics to the contrary, I need drag and drop, and so do you.This provides a visual cue for users about which kinds of data an an application/window/field can accept.In , and changing between drag imagery can be a bit unsettling (unless you're trying to indicate that different behavior will occur if you drop in different locations, in which case it's entirely appropriate). Now drag some text into the window, release it, and it will begin searching as if we had typed the text into the textfield and hit search.In the third article I said that I would also include a list of resources in this segment, but after it occured to me to cover using a second nib (understanding which opens up your Cocoa horizons), I felt like that was a topic that would be genuinely beneficial to cover, and that covering drag and drop, additional nibs and the references would be a bit much material in one article.If you haven't been following along thus far, you can download the current zip of the project.The first thing we need to do is open up and create a helper function that will accept a search string as a parameter and then perform the search (as well as update the textfield with the search string for visual confirmation).We need to do this, because we'll be subclassing and so on.
In the third part of the tutorial we focused on three smaller tasks: handling double clicks, caching to disk, and adding a progress indicator.
Thats pretty inconvenient, and really cuts back on the utility of dragging. We're not going to look at dropping data into our tableview, mostly because I couldn't imagine a single way to even contrive a use for that given that we're displaying the results from Metaweb as if they were immutable.
Perhaps if was extended to modify data, then such an operation might have some value (a way to import data, for example).
For example, if you look at i Tunes approach to playlists, by default when you click on a playlist it just displays in the list in the main window. , on the other hand, you can't do with one nib (unless you create and populate the window programatically, which is possible but will typically be far more work).
Once you graduate from trivial applications, you will inevitable need to learn about using multiple nibs in one project, and--like everything we've looked at in this tutorial--it really isn't that hard once you decide to sit down and do it.