ゴール
プログラム
struct Photo: View { var body: some View { HStack { Image("image_06") .resizable() .aspectRatio(contentMode: .fit) VStack(alignment:.leading) { Text("タイトルタイトルタイトル") .font(.system(size:24)) // fontsize .foregroundColor(Color.black) // font color Spacer() Text("説明欄です説明欄です説明欄です説明欄です説明欄です") .font(.system(size:20)) // font family and size .foregroundColor(Color.black) // font color .frame(maxHeight:.infinity) //.lineLimit(1) } } .frame(height: 100) } }
ポイント
・親ビューのframeで高さを決めて、子は自分で高さを持たせないようにしている
→ 画像のサイズに影響されないので、セルの高さが一定になる。