0

Here is the layout of my view:

Pic

The blue bit is an NSTextView, and the gray bit is an NSVisualEffectView. The visual effect view is set to blend with whatever's behind that view within the window. I want the text view to be able to scroll behind the visual effect view so that it blends with the status label and the button. I have tried the following:

  1. In the storyboard, just make the text view go behind the visual effect view. However, the text on the very bottom will just get covered up as the text view won't know that the visual effect view is there and just stops scrolling under it.
  2. From this question, I tried overriding wantsDefaultClipping, alignmentRectInsets as well as using CALayer's maskToBounds property on the text view's enclosing scroll view. But all of those doesn't work either.

Did I do something wrong here? What else should I do to make either of the 2 options work?

Thanks

Tom Shen
  • 1,838
  • 3
  • 19
  • 40
  • Is the text view not drawing its text or is the visual effect view too opaque? – Willeke Jul 21 '18 at 14:54
  • @Willeke It wasn't drawing. I checked it by reducing the size of the text view a little bit and it crops. – Tom Shen Jul 21 '18 at 14:55
  • How can I reproduce the issue? I put a `NSTextView` and a `NSButton` in a window and a `NSVisualEffectView` on top of both. The text and button are almost invisible. I have to select the text or click on the button to see where they are but the text is not clipped. – Willeke Jul 21 '18 at 23:13
  • @Willeke So the text view currently don’t overlap behind the visual effect view. The text view is the blue view. The button and the label is a sub view of visual effect view. Also make sure the visual effect view is set to blend within window. – Tom Shen Jul 22 '18 at 02:55
  • Usually a view doesn't draw outside its frame and is clipped by its superviews. – Willeke Jul 22 '18 at 12:56
  • @Willeke OK then. Is it possible to continue with the first method and just make the text view over scroll over the visual effect view? – Tom Shen Jul 22 '18 at 12:57
  • What you said is correct: "just make the text view go behind the visual effect view. However, the text on the very bottom will just get covered up". – Willeke Jul 22 '18 at 15:10
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/176517/discussion-between-tom-shen-and-willeke). – Tom Shen Jul 22 '18 at 15:12

0 Answers0