如何复制 UIKit/SwiftUI 元素背景(如 UITabBar/TabView 背景)
How to replicate UIKit/SwiftUI elements background (like the UITabBar/TabView background)
我想复制 UITabBar(和类似的 UIKit/SwiftUI 元素)的背景(包括相同的模糊效果和细灰色边框及其适应性)并将其应用于另一个 UI元素。
我怎样才能做到这一点?
我尝试复制它,但是当我将我的新视图堆叠在其他不同颜色的视图上时,行为有所不同(并且不支持夜间模式)。
我不在乎答案是针对 UIKit 还是 SwiftUI 框架。
请参阅 UIInterface
模块中的 UIColor
扩展,如下例(有很多):
* 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 }
我想复制 UITabBar(和类似的 UIKit/SwiftUI 元素)的背景(包括相同的模糊效果和细灰色边框及其适应性)并将其应用于另一个 UI元素。 我怎样才能做到这一点?
我尝试复制它,但是当我将我的新视图堆叠在其他不同颜色的视图上时,行为有所不同(并且不支持夜间模式)。
我不在乎答案是针对 UIKit 还是 SwiftUI 框架。
请参阅 UIInterface
模块中的 UIColor
扩展,如下例(有很多):
* 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 }