Display message when the cursor is over the NSSearchField - macos

I need to display a message similar the following attachmnet
I dont know the technical term what exactly it called in cocoa terminology.
So,I could not google it also.just I am interested to know how can I implement this feature.

They're called tooltips and can be added to any view. You can add them programmatically like so:
[searchField setToolTip:#"Hello World!"];

Related

Editing custom NSCell

I'm in the process of creating a custom NSCell, which will work like the shortcut capture cells in XCode, and trying to figure out how to intercept edit requests (for instance, when a user double-clicks a cell). Is there some way to determine that an edit is being initiated?
Are you looking specifically to detect a double-click in a cell? If so, setDoubleAction:(SEL)aSelector is what you're looking for.
Or is the question more generically about detecting when a cell will enter 'editing' state? In that case, see the table delegate method tableView:shouldEditTableColumn:row:

Cocoa OSX custom widgets/controls

I want to know how can I create custom widgets/controls in Cocoa.
Not a full tutorial, but some guidance on what to start looking into. I'm confused by custom views, Core Animation, etc. I feel lost.
I see a lot of cool looking controls, like in Reeder App, or Sparrow etc. For example:
The left side is a collapsable menu that includes animations etc. How can I achieve something similar? I thought of using a WebView + HTML + JavaScript, but that doesn't seem like a very optimized solution.
Controls are views, so if custom views confuse you, you'll need to get that figured out before moving on to custom controls. Although you should really read the entire View Programming Guide, the section called Creating a Custom View will get you started on creating your own views. Try creating a simple view that draws a circle, for example, or the time.
When you've got views figured out, move on to custom controls. Most controls work about the same way. The user touches them, and the control responds by: a) tracking the user's input, b) changing its value, c) sending its action message to its target, and d) giving the user some feedback by redrawing itself. To get started, first make sure that you know how to use controls. Reading Control and Cell Programming Topics should help, and the section titled Subclassing NSControl covers (obviously) creating your own subclasses.
The example you provided is pretty clearly Apple's Mail.app. The view on the left side of the window might be an instance of NSOutlineView, or it might be a custom class. Either way, NSOutlineView would be a good starting point if you want to duplicate that functionality. NSOutlineView is a subclass of NSTableView, which in turn is a subclass of NSControl, which in turn is a subclass of NSView. Read Outline View Programming Topics for help getting started -- tables and outlines are extremely useful, but also more complicated to use than basic controls like buttons and text fields.
I know it's only a part of the UI, but I've recently coded something similar to the sidebar. If you look though the source-code it may give you some help on learning how to use custom controls and cells.
You can check it out on Github:
https://github.com/iluuu1994/ITSidebar

Cocoa/OSX tagging UI

I'm looking to implement a tagging interface on OSX that lets users type text "tags" to attach to an object. Ideally, I'd like to implement a fancy UI like the screenshot below:
-
Note: This shows multiple states
This UI lets the user type tags, then groups them into a rounded shape when enter is pressed. They can be deleted by dragging over to highlight (shown in dark blue) and pressing delete. I think this is a slick interface for quickly jotting down a bunch of tags without having to repeatedly press form buttons.
I've seen this interface in Mail.app and a few other places in OSX, so that makes me wonder if there's some sort of cocoa class out there for this. Anyone know of one? If not, I guess I'm looking at a custom opengl view.
Take a look at NSTokenFieldCell.

HTML-like view in Cocoa?

learning Cocoa can be pretty tough for web developers. Some things are so simple in HTML, and I have no idea, how to do this in Cocoa.
Let me just show you an image here, to show you what I have on my mind.
So it's kinda like a blog. Each post has variable length, so it can take up some space. Also, you're able to scroll through posts.
I was thinking about using NSTableView or NSCollectionView, but since I don't know much about Cocoa, I'm asking you for advice.
Also please do link any related articles.
Updates
So here are some things that I discovered.
I could make a subclass of NSCell and use it in Table View. I can use it, I can put there a string, something like this:
http://pastie.org/1140412
(please take a look at this code, I'm wondering if I should use awakeFromNib/setDataCell combination)
But string is not enough. I need a NSTextView. The problem is, it doesn't have method like drawInRect: withAttributes:. So I don't know how to draw it into that cell. I guess I'm missing some basics here, so I'm just gonna study some Cocoa views now.
Any ideas are welcome.
You want to use a NSTableView. And I will recommend to take a look/glance at NSTableView, NSTableViewDelegate and NSTableViewDataSource docs:
http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSTableView_Class/Reference/Reference.html
http://developer.apple.com/mac/library/documentation/cocoa/reference/NSTableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008622
http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40004178
You choose the object you want to be your datasource depending on the data you have.
The delegate is the object that helps you to so some settings, like rows, groups, cells, etc.
There are useful methods of NSTableViewDelegate you want to implement like – tableView:heightOfRow:
and just google NSTableView tutorial or something, there are many good examples ;)
You could just use a WebView and write it in HTML.
Look at http://mattgemmell.com/source for an example: the Skinnable App one.

Simply make a label say Hello World in Cocoa (Mac programming)

I'm a total newbie to programming in cocoa for the mac so this question is probably easy. I have a window, and on that window I have a Label.
I want to be able to update this label from my program with the current status or what's going on (eg. reading in file, parsing, etc.). My problem is that I don't know how to access the label and change it's text property. I tried "MyWindowName." hoping I would be able to reference the label from the Window. I don't even know what the labels name is, or even if it has a name.
How do I reference this label in my program to change it?
You probably need to go here and walk through some tutorials: http://www.cocoadevcentral.com/
A quick summary is that unlike other technologies, you don't access the controls directly (or shouldn't access them). Instead, you create outlets in a controller, which you then graphically connect to the controls and they update automagically. These tutorials will show you the way.
A label is just an NSTextField with different settings about editing/fonts, etc. Just make an outlet in your controller that connects to the view in Interface Builder, and you can change it like you would any other NSTextField.

Resources