I have two images in a VStack and both images being resizable. One of the image is set to fill with clipped.
VStack(spacing: 8) {
Image(uiImage: project.image!)
.resizable()
.aspectRatio(contentMode: .fill)
ZStack {
Image(uiImage: UIImage(named: "ic_add_project")!)
Image(uiImage: UIImage(named: "corner_pages_72pt")!)
.resizable()
}
}
I have almost the result I wanted by removing .aspectRatio(contentMode: .fill)
but the top image get stretch and distorted.
How can I set two images one on top of each other with the same size and have the image scaledToFill so it doesn’t get stretch? I can’t use fixed frame size, I’m hoping to distribute the images evenly between the stacks.
2
Answers
Does this work?
Try to put them into overlay of color. Color fills available space, so two colors fill space equally, and images in overlay should be sized as specified not affecting each other.