Question

In Windows system, a usual web link is like a underlined, blue text. When clicking it, it will lead you to a web browser and open the website.

However, I did not find a perfect way to create the same effect in Xcode.

This is how I do currently:

First of all, here is a part of a custom table. Each line repersents a subview, while there is a blue background at the bottom of it. The blue background appears(bye setting a blue image) when mouse-in and displeared(by setting a white image) when mouse-out. Here is the visual effect:
Image, click me

And when mouse is on the "Connect" label, the mouse should change its own appearance into a "finger" like the a normal weblink:
Image, click me

I subclassed NSTextField and overwrite the mouseDown: and mouseUp: method to make the label clickable. But I have no idea how to change the mouse appearance...

Any suggestions? Thank you all very much!!!

Was it helpful?

Solution

I found my own solution. Follow the sample code: DragItemAround
Using the method addCursorRect:cursor:

Besides, subclass the NSTextField and capture the mouseDown: method to implement click action.

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