我想复制UITabBar(和类似的UIKit / SwiftUI元素)的背景(包括相同的模糊效果和细灰色边框及其适应性),并将其应用于另一个UI元素。我该怎么做?
我试图复制它,但是当我将新视图堆叠在其他不同的颜色视图上时,行为是不同的(并且不支持夜间模式。
我不在乎答案是针对UIKit还是SwiftUI框架。
UIColor
模块中的UIInterface
扩展,例如以下示例(有很多示例): * 1. systemBackground
* Use this stack for views with standard table views, and designs which have a white
* primary background in light mode.
*/
@available(iOS 13.0, *)
open class var systemBackground: UIColor { get }
/* 2. systemGroupedBackground
* Use this stack for views with grouped content, such as grouped tables and
* platter-based designs. These are like grouped table views, but you may use these
* colors in places where a table view wouldn't make sense.
*/
@available(iOS 13.0, *)
open class var systemGroupedBackground: UIColor { get }
/* Fill colors for UI elements.
* These are meant to be used over the background colors, since their alpha component is less than 1.
*
* systemFillColor is appropriate for filling thin and small shapes.
* Example: The track of a slider.
*/
@available(iOS 13.0, *)
open class var systemFill: UIColor { get }