4

I have updated to macOS High Sierra and have now unexpected problems in my project, the problems not seen before in macOS Sierra. I have custom NSImageView and after drag and drop of image in this NSImageView I can draw the rectangles on top of the image using CAShapeLayers and mouseDown, mouseDragged function. Then, I can calculate intensities of the image parts inside of the rectangles. The intensities data is in array and this array is used for NSTableView. NSImageView and NSTableView are in the same NSView. The intensities calculation is in the @IBAction function. After the update when I pressed the button for calculation of the intensities the rectangles moved below the image (before they were staying on top). I have found out, that the reason for this effect is reloadData() function for the table. When this function is turn off the rectangles are staying on top of the image.

Can somebody explain this strange things and what I can do to fix it ? I need to keep the rectangles on top of the image after I pressed the calculation button.

Update I have updated High Sierra, but reloadData() for NSTableView has the same effect on disappearing the CAShapeLayers as before.

VYT
  • 1,071
  • 19
  • 35
  • I'm not sure if my answer to my related question will help you: https://stackoverflow.com/a/46452867/2148757 – Sashah Oct 04 '17 at 13:27
  • I have a related problem, I'm also using nstableview and all my cells become invisible on reloadData() after the highsierra update... – user2403221 Oct 09 '17 at 20:08
  • @user2403221 I have found out (after advice from one guy to set the value for Z axis) when I explicitly set the values for Z axis for the the rectangles (CAShapeLayers), instead of relying on the default values (as it was in Sierra), then CAShapeLayers are staying on top. I guess in Sierra and High Sierra after reloadData() layers are redrawing in different order along Z axis. – VYT Oct 10 '17 at 21:07

1 Answers1

1

I have a similar problem after upgrading to High Sierra, the subviews I was adding to my NSImageView were no longer displayed.

To solve the issue, I added the following line to my code (NSImageView was added programmatically), as recommended by this link:

    imageView.wantsLayer = true
Daniel Mavrakis
  • 572
  • 10
  • 17
  • I have looked again in the code, tested what you suggest and found out that now in High Sierra 10.13.4 everything is working as before in Sierra, i.e. without imageView.wantsLayer = true or without writing the values for Z positions of the layers. Probably, some changes were made in High Sierra 10.13.4 in comparison with earlier version of High Sierra. – VYT May 23 '18 at 07:18