반응형
cornerRadius
-
[SwiftUI] ImageView에 Radius 적용(RoundedImageView)iOS 2021. 7. 29. 13:49
개요 ImageView에 cornerRadius를 적용하여 모서리가 둥근 ImageView를 만들어 보자. RoundedImage 구현 clipShape를 이용한 방법 아래 코드처럼 clipShape에 RoundedRectangle을 넣어 모서리가 둥근 ImageView를 만들 수 있다. struct RoundedImage: View { var body: some View { Image("dog") .clipShape(RoundedRectangle(cornerRadius: 100)) } } 위 코드의 Preview는 아래 사진과 같이 나온다. cornerRadius를 이용한 방법 cornerRadius를 직접 입력하여 모서리가 둥근 ImageView를 설정한다. struct RoundedImage: Vi..