首页 > 解决方案 > 如何在 swift iOS 中创建类似于 spotify 的均衡器 UI 的 UI

问题描述

你好,我是 iOS 新手,对创建复杂的 UI 没有太多想法,我想创建像 spotify 的均衡器 UI 一样的均衡器 UI。目前我已经使用 UISlider 设置了我的均衡器。我应该使用什么来修改我的 UI,例如 spotify 的 EQ UI。如果您可以帮助使用示例代码,那就太好了。谢谢你。


这是我的 EQ UI。

这就是我想要创建的。spotify 的 EQ UI。

标签: iosswiftuser-interfacespotifyuislider

解决方案


The approach could be simple:

  • Make the color of your sliders gauges clear so they are transparent
  • Read the values of your sliders and draw lines between them
  • Create a polygon with the coordinates of your sliders values + the two points at the bottom and fill it with a color gradient

As your sliders are equally spaced you can deduce their x position knowing the width of the graph container, the y value is the slider current value + some correction with the slider button size.


推荐阅读