티스토리 뷰

 

선택 했을때,  안했을 때!

 

cornerRadius랑 background때문에 약간 고생했다 ㅠ

struct GenderStyle: ButtonStyle {
  @State var isSeleceted: Bool
  func makeBody(configuration: Configuration) -> some View {
    configuration.label
      .padding(.vertical, 12)
      .padding(.horizontal, 45)
      .foregroundColor(isSeleceted ? Color.white : Color("coolGrey"))
      .background(isSeleceted ? Color("lightPeriwinkle") : Color.white)
      .cornerRadius(8)
      .overlay(RoundedRectangle(cornerRadius: 8)
        .stroke(Color("silver"), lineWidth: 2)
      )
  }
}

팁은..padding을 Label에다가 추가하는 것, cornerRadius를 overlay 에다가도 주고, label에다가도 주는 것이었다. 

 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함