Closed heemings closed 4 months ago
HStack { Image(systemName:"rectangle.split.2x2") .resizable() .foregroundColor(.white) .frame(width: 20,height: 20) Image(systemName:"bell") .resizable() .foregroundColor(.white) .frame(width: 20, height: 20) Image(systemName: "cart") .resizable() .foregroundColor(.white) .frame(width: 20, height: 20) }
이렇게 HStack, ZStack, VStack을 사용해 화면을 구현해보았습니다
let searchBar = UISearchBar() searchBar.placeholder = placeholder if let textField = searchBar.value(forKey: "searchField") as? UITextField { textField.backgroundColor = UIColor.white textField.attributedPlaceholder = NSAttributedString(string: textField.placeholder ?? "", attributes: [NSAttributedString.Key.foregroundColor : UIColor.lightGray]) textField.textColor = UIColor.black }
searchBar도 구현해봤습니다
스크롤 화면이 아니다 보니 화면이 center에 고정되어서 위로 고정하고 싶었는데 잘 안 됐습니다. 그래서 찾아보다 .padding(.top,getSafeArea().bottom == 0 ? 150 : -100) 다음 코드를 사용해봤는데 15버전 이상에서는 적용이 안 된다고 합니다. 이렇게 기종에 따른 레이아웃을 맞추는 정확한 방법이 궁금합니다.
.padding(.top,getSafeArea().bottom == 0 ? 150 : -100)
📍Summary
💡PR Point
이렇게 HStack, ZStack, VStack을 사용해 화면을 구현해보았습니다
searchBar도 구현해봤습니다
🤔 Question
스크롤 화면이 아니다 보니 화면이 center에 고정되어서 위로 고정하고 싶었는데 잘 안 됐습니다. 그래서 찾아보다
.padding(.top,getSafeArea().bottom == 0 ? 150 : -100)
다음 코드를 사용해봤는데 15버전 이상에서는 적용이 안 된다고 합니다. 이렇게 기종에 따른 레이아웃을 맞추는 정확한 방법이 궁금합니다.🔑 Simulator