How to resize Image with SwiftUI?

前端 未结 14 511
清歌不尽
清歌不尽 2020-12-23 19:54

I have a large image in Assets.xcassets. How to resize this image with SwiftUI to make it small?

I tried to set frame but it doesn\'t work:

Image(roo         


        
14条回答
  •  有刺的猬
    2020-12-23 20:49

    Note : My image name is img_Logo and you can change image name define image properties this:

     VStack(alignment: .leading, spacing: 1) {
                            //Image Logo Start
                            Image("img_Logo")
                                .resizable()
                                .padding(.all, 10.0)
                                .frame(width: UIScreen.main.bounds.width * 0.4, height: UIScreen.main.bounds.height * 0.2)
                            //Image Logo Done
                        }
    

提交回复
热议问题