问题描述
使用SwiftUI。由于某些非常奇怪的原因,此按钮不可单击(它出现但不执行其动作任务)。当我将Button放在HStack外面时,它突然工作了。我是愚蠢的还是它的错误。谢谢!
ZStack{
Image("Background")
.resizable()
.edgesIgnoringSafeArea([.top,.bottom])
vstack{
HStack{
Text("Dari Learner")
.font(.largeTitle)
.foregroundColor(Color.white)
.padding(.top,50)
.padding(.leading,90)
Button(action: {
print("Button Tapped")
self.viewmodel.createQuiz()
}) {
Text("Next")
.background(Color.green.opacity(0.5))
.cornerRadius(25)
.opacity(self.dim ? 1 : 0)
.transition(.scale)
.animation(.easeInOut(duration: 1.5))
}// !disabled because this is also used for the answerbubbles
}
ZStack{
AnswerBubble(fillColor: Color.black,isChosen: false)
Text(viewmodel.getActualAnswer().word.DariWord)
}
Grid(viewmodel.answers) { answer in
QuizView(answer: answer,fillColor: self.colorFor(answer: answer,correctAnswer: self.viewmodel.getActualAnswer())).onTapGesture {
self.tappedAnswers.append(answer)
if self.viewmodel.chooseAnswer(answer: answer){
self.dim.toggle()
self.disabled.toggle()
}
}
.animation(.easeInOut(duration: 1.0))
.disabled(self.disabled)
}
}
.edgesIgnoringSafeArea([.top])
}.ondisappear{
self.viewmodel.createQuiz()
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)