iOS/SwiftUI

iOS SwiftUI) Image

Developer-Michelle 2023. 2. 20. 18:28

iOS SwiftUI) Image

import SwiftUI

struct CircleImageView: View {
    var body: some View {        
        Image("pizza")
            .resizable()
            .scaledToFill()
            .frame(width: 300, height: 300)
            .clipShape(Circle())
            .shadow(color: .gray, radius: 10, x:0, y:10)
        
            .overlay(
                Circle().foregroundColor(.black)
                    .opacity(0.4))
            .overlay(
                Circle().stroke(Color.red, lineWidth: 10)
                    .padding()
            )
            .overlay(
                Circle().stroke(Color.yellow, lineWidth: 10)
                    .padding(30)
            )
            .overlay(
                Circle().stroke(Color.blue, lineWidth: 10)
            )
            .overlay(
               Text("호호")
                .foregroundColor(.white)
                .font(.system(size:30))
                .fontWeight(.bold)
            )
    }
}

 

import SwiftUI

struct ContentView: View {
    var body: some View {
        NavigationView {
            VStack {
                
                Image("pizza")
                    .frame(height: 10)
                    .offset(y: -800)
                
                CircleImageView()
                
                HStack {
                    NavigationLink(destination: MyWebView(urlToLoad:"https://www.youtube.com")
                    ) {
                        Text("구독하러 가기")
                            .font(.system(size:20))
                            .fontWeight(.bold)
                            .foregroundColor(.white)
                            .padding()
                            .background(.red)
                            .cornerRadius(20)
                    }
                    
                    NavigationLink(destination: MyWebView(urlToLoad:"https://www.daum.net")
                    ) {
                        Text("다음사이트 이동")
                            .font(.system(size:20))
                            .fontWeight(.bold)
                            .foregroundColor(.white)
                            .padding()
                            .background(.orange)
                            .cornerRadius(20)
                    }
                } //HStack
                .padding(50)
            }
        }
        
    }
}

 

 

참고) https://www.youtube.com/watch?v=ZodiJ0oy2kM&list=PLgOlaPUIbynqyJHiTEv7CFaXd8g5jtogT&index=6

'iOS > SwiftUI' 카테고리의 다른 글

SwiftUI에서 Info.plist 사용 방법  (0) 2023.10.01
iOS SwiftUI) List (UIKit의 tableView에 해당)  (0) 2023.02.22
iOS SwiftUI) Text 관련  (0) 2023.02.20
iOS SwiftUI) WebView 띄우기  (0) 2023.02.20
SwiftUI 기본 정리  (0) 2023.02.20