Friday, November 20, 2026
HomeiOS Developmentios - How do i align a picture with textual content in...

ios – How do i align a picture with textual content in an HStack?

[ad_1]

I’m making an attempt to create a view that could be a rectangle with textual content and pictures inside. That is completed in a VStack. On the backside of the VStack, I’ve an HStack the place I’ve a small picture and a quantity subsequent to it. These have to be centred aligned however I can not seem to make that occur.

The picture is larger up than the quantity. I want them to be at an equal peak.

VStack(alignment: .middle, spacing: 0) {

                                    Picture("ProductLogo")
                                        .resizable()
                                        .aspectRatio(contentMode: .match)
                                        .clipped()
                                        .padding()
                                        .layoutPriority(1)


                                    Textual content("Textual content Right here")
                                    .font(.title2)
                                    .fontWeight(.daring)
                                    .foregroundColor(.black)
                                    .minimumScaleFactor(0.5)
                                    .multilineTextAlignment(.middle)
                                    .padding(.main, 5)
                                    .padding(.trailing, 5)
                                    .padding(.backside, 5)


                                Textual content("Subtitle")
                                    .font(.headline)
                                    .foregroundColor(.grey)
                                    .lineLimit(2)
                                    .padding(1)
                                    
                                    //HERE IS WHAT NEEDS TO BE ALIGNED
                                    HStack {
                                        
                                        Picture("CoinImage")
                                            .resizable()
                                            .body(width: 35, peak: 35, alignment: .middle)
                                    
                                    Textual content("500")
                                        .font(.system(measurement: 20))
                                        .padding(.prime,20)
   
                                    }    
                        //END OF HSTACK
                                }

Right here is a picture of the VStack:

enter image description here

The five hundred must be degree with the coin picture

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments