I looked around, and I tried various things, but can’t seem to get it right. Can anyone tell me how I can get my image in a list from being a square on the left to be the whole row width and height without the image squashing, so it basically takes the center of the image and fills the whole row without any distortion.
1- UIKit/Storyboard or 2- SwiftUI?
1 - UIKit/Storyboard: in the Attributes pane, locate the ‘View’ section and ‘Content Mode’ which best meets your requirements;
2- SwiftUI: Image(“yourImageNameGoesHere”)
.resizable() // this is to tell Xcode that the image needs to be resized
.scaledToFill() // choose other content modes which meet your requirements
.frame(width: 60, height: 60, alignment: .center) // change the frame size to match your list size
The attributes in SwiftUI are many, and are optional.
Hey thanks for the reply, I got that far myself too, my problem is that it’s not covering the entire row, like a background.
Here you can see the problem marked in red:
Hey Zenocode, try asking Mark Moeykens. He’s pretty deep into SwiftUI and he might know. You can grab the link to this specific post (link icon in the lower right corner) and send it to him!
I’ve tried it on my list, it seems to work. BUT, I have not tried this out for different screen sizes.