Does a popup seem like Xcode completion?

I would like to create something similar to the code completion function in Xcode 4. (The visual style and behavior, not the type of data structure needed to complete the code).

When a user types in a pop-up window, other word choices are displayed.

Function in action:

Code-Completion window in action.

I'm not quite sure where to start. I am mainly interested in the visual appearance of the window and how I should populate the list with a given set of words. Later I will get a window so that the window follows the cursor on the screen, etc.

Basically I am looking for a general overview of how to display such data in a “window”, and how to cygus the appearance of a thing so that it looks like a small informational pop-up window, and not a full-screen OS X window.

+5
source share
3 answers

Just add a subview to the current view, which looks like a tableview . Programmatically make it be visible on an event (like mouseDown) and adjust its position depending on where you want it. You will need to create the correct delegation / data source methods, but this should be pretty simple. You will also need a source for the words you want to use in your autocomplete, and put them in an array or something for your tableview data source to go through .

, , . , , .

+3

() . AutoComplete, subview . () ( ) . :

", , , , , ", "sp", : ", , "

, ( ) "- (NSArray *) completeFragment: (NSString *) ;". OCUnit , . , . currentWord AutoComplete, , "newFragment: (NSString *)"; . OCUnit , propertyCompletions, (, , tableView).

0

Here's a question about how to track the global position of a text entry point: How to get the global screen coordinates of the current selected text through the accessibility APIs.

0
source

All Articles