button - 按钮SwiftUi内图像的背景颜色问题
问题描述
按钮内的图像显示为蓝色。我不知道如何解决它。
Button(action: {self.count += 1}) {
Circle()
.fill(LinearGradient(gradient: Gradient(colors: [Color("linkAccount1"), Color("linkAccount2")]), startPoint: UnitPoint(x: 0, y: 0.2), endPoint: UnitPoint(x: 1, y: 1)))
.frame(width: 80, height: 80)
.shadow(color: Color("shadowColor1"), radius: 7, y: 7)
.overlay(
//issue with image backgroud or foregroundColor
Image("linkAccount")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 60, height: 60))
}
解决方案:Image("linkAcount").renderingMode(.original)
解决方案
按钮中包含的图像和文本以强调色呈现,默认情况下为蓝色,只需应用:
.accentColor(.white)
到您的 Button 以将图像绘制为白色。
推荐阅读
- mybatis - MyBatis:无效比较:java.util.Date 和 java.lang.String
- python - 在外部库中使用时禁用 tensorflow 日志
- javascript - [{a: 1}],[{b: 2}] 转换为 {a:1,b:2}
- python - Pandas get cell value by row NUMBER (NOT row index) and column NAME
- sql - Oracle 10g 和 11g 中的 Regexp_like
- c - 传递 'atoi' 的参数 1 从整数中生成指针,而无需在 C 中进行强制转换
- sequelize.js - 是否可以使用 sequelize 中的钩子获取插入行的 ID?
- java - 缺少return语句,但是return语句在那里?
- microsoft-graph-api - 用于 Outlook 邮件还原的 Graph API
- apache-spark - 如何在pyspark中进行并行处理