0

I'm looking to change the look of my row view when it becomes a group row, or possibly more specifically when it becomes the group row that is stuck at the top of the NSTableview.

I wondered if there was a notification or some property that could be checked. Ideally I'd like to do some kind of animation as it gets within range of the top from one view to the next.

I'm thinking along the lines of tracking the row views coordinates in relation to the clip view/scroll view... Would that be the approach you would take?

Any suggestions?

Sammy The Hand
  • 175
  • 1
  • 11

2 Answers2

1

when it becomes a group row

Are you expecting a row to change whether it is a group row over time?

I'm looking to change the look of my row view […] when it becomes the group row that is stuck at the top of the NSTableview.

Have the row view's -drawRect: method consult its own floating property and draw differently based on its value. You may need to override the -setFloating: setter to mark your row view as needing display, too.

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154
  • Hi Ken, Thanks for responding. No, rows of a certain type will always be a group row, but I'm interested in when the group row becomes the floating row that sits at the top of the tableview. I shall look into what you suggest. It seems a good place to start. Thankyou. – Sammy The Hand Feb 05 '17 at 02:44
0

Ken Thomases suggestion was just the suggestion I needed. I want to directly change the NSTableCellView so I called the following method from there, but you could also call it directly from a custom NSTableRowView.

From a custom NSTableCellView:

override func draw(_ dirtyRect: NSRect) {
    super.draw(dirtyRect)
    if let rowView = self.superview as? NSTableRowView, rowView.isFloating == true {
        Swift.print("Row is Floating")
    }
}

From a custom NSTableRowView:

override func draw(_ dirtyRect: NSRect) {
    super.draw(dirtyRect)
    if self.isFloating == true {
        Swift.print("Row is Floating")
    }
}

Allowing me to change the view as desired. Thankyou Ken

Sammy The Hand
  • 175
  • 1
  • 11