HomeiOS Developmentios - Create SwiftUI View with an Picture with a number of...

ios – Create SwiftUI View with an Picture with a number of clickable areas


I need to create a View which scales a ZStack of pictures. When i give them an onTapGesture solely the highest layer is offered even on its clear areas when the background needs to be tapable.

I did attempt to alter the renderingMode to template to mark the clear areas as not rendered.
I even tried to create UIButton as alternative as a result of in oder Model UI Equipment clear areas weren’t clickable.

ZStack{
                        Picture("backgound"))
                            .resizable()
                            .scaledToFit()
                        Picture("foreground")
                          .resizable()
                          .scaledToFit()
                        Picture("clickableHighlight1")
                          .resizable()
                          .scaledToFit()
                          .onTapGesture {
                            //do stuff particular to highlite1 space
                          }
                        Picture("clickableHighlight2")
                          .resizable()
                          .scaledToFit()
                          .onTapGesture {
                            //do stuff particular to highlite2 space
                          }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments