小编fir*_*urt的帖子

教程主题背景颜色不起作用

尝试遵循这个 iOS dev tutorial.

\n

当我到达第 7 步时,代码没有按预期更改背景颜色。

\n

引用“步骤 7\n添加一个名为 mainColor 的颜色属性,该属性使用枚举\xe2\x80\x99s rawValue 创建颜色。\n此属性从资产目录初始化颜色。”

\n

这是主题文件中的代码:

\n
import SwiftUI\n\nenum Theme: String {\n    case bubblegum\n    case buttercup\n    case indigo\n    case lavender\n    case magenta\n    case navy\n    case orange\n    case oxblood\n    case periwinkle\n    case poppy\n    case purple\n    case seafoam\n    case sky\n    case tan\n    case teal\n    case yellow\n    \n    var accentColor: Color {\n            switch self {\n            case .bubblegum, .buttercup, .lavender, .orange, .periwinkle, .poppy, .seafoam, .sky, .tan, .teal, .yellow: return .black\n            case .indigo, …
Run Code Online (Sandbox Code Playgroud)

ios swiftui

4
推荐指数
1
解决办法
2188
查看次数

标签 统计

ios ×1

swiftui ×1