Jakob Jakob - 12 days ago 5
Swift Question

Displaying object status in table (icon)

I want to show the status of an object within my NSTableView.
For example, plesae look onto the screenshot below. Caching, File Sharing, Mail, Profile Manage, Websites and Wiki have a green icon near their "tab".

Status is defined by the following within my Device class:

var online: Bool = false


When it's online, the bool says true, if not, it's false ;)

Any ideas how I can bring this to the following?

enter image description here

(This is an older screenshot, I want the icon on the left side of the "test" name /label. The status table column has already been removed, I first thought this would be a solution but it wasn't what I am looking for)

enter image description here

Answer
  • Use view based table view.
  • Use a table cell view with text field and image view.
  • Set the image to NSImage(named: NSImageNameStatusAvailable) or other depending on online.
Comments