淡出NSScrollView的顶部和底部 [英] Fade out top and bottom of an NSScrollView

查看:97
本文介绍了淡出NSScrollView的顶部和底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以使NSScrollView的顶部和底部边缘淡化为透明的吗?我已经看到一些通过在子视图中添加某种颜色的渐变来淡化它的代码/答案,基本上是用背景色覆盖顶部和底部。但是,我希望它实际淡出为alpha = 0,因此您可以实际看到滚动视图后面的视图内容。我计划让我的应用在NSScrollView后面具有各种背景,并且在边框上没有任何过渡,它看起来非常便宜。

Is there any way to make the top and bottom edges of an NSScrollView to fade to transparent? I've seen some code/answers that 'fades' it by adding a gradient of a certain color to the subview, basically, covering up the top and bottom with the background color. However, I would like it to actually fade to alpha=0, so you can actually see the contents of the view behind the scroll view. I'm planning my app to have various backgrounds behind this NSScrollView, and without any kind of transition on the borders it looks pretty cheap.

推荐答案

这是现成的底部&顶端淡淡的颜色:

Here is a ready-made bottom & top fade for you:

https:// github。 com / jnozzi / JLNFadingScrollView


您可以配置其淡入淡出的颜色(通常是阴影的灰色/黑色或滚动视图的背景不褪色的颜色)

You can configure its fade color (usually a gray/black for shadow or the scroll view’s background color for ‘fade-to-nothing’)

这篇关于淡出NSScrollView的顶部和底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆