ios

    [iOS] grouped style tableView에서 위아래 여백 제거하기

    UITableView(frame: .zero, style: .grouped)로 사용하는데 상하단의 여백을 없애고 싶을 때가 있습니다. 이 글에서는 하단의 여백을 없애는 것으로 예를 들어보겠습니다. 두가지를 지정해주면 됩니다. 1. header or footer height를 최소로 지정 func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { UIView() } func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { .leastNormalMagnitude } 2. content inset 없..

    [iOS] 다크 모드에서 cgColor 적용하기

    안녕하세요 코찐입니다. 이번에는 다크모드에서 cgColor 적용하는 이슈를 정리해보겠습니다. iOS는 UITraitCollection를 통해서 적절한 컬러를 적용하게 되는데요. https://developer.apple.com/videos/play/wwdc2019/214/ 에서 내용을 소개하고 있습니다. https://eunjin3786.tistory.com/301 이 글에서 WWDC 내용을 잘 정리해주고 있습니다! 간단한 예제를 통해 알아보겠습니다. MainColor라는 컬러셋을 만들었습니다. 뷰의 테두리를 그리거나 그림자를 넣을 때 등을 위해서 CGColor를 사용합니다. cgColor는 dynamic color를 지원하지 않아서, UITraitCollection를 먼저 반영해서 cgColor로 뽑아..

    [iOS] UITextField placeholder color 변경하기

    안녕하세요 코찐입니다. UITextField를 쓸 때 플레이스 홀더 텍스트의 색상을 변경할 일이 있습니다. textField.placeholderColor 로 지정가능하면 좋을텐데 그런 변수는 없습니다... 그래서 매번 검색해서 찾게되는데요. 다음에 또 찾을 수 있도록 기록차 남겨둡니다. 해결책 https://stackoverflow.com/questions/1340224/iphone-uitextfield-change-placeholder-text-color iPhone UITextField - Change placeholder text color I'd like to change the color of the placeholder text I set in my UITextField controls, t..

    [iOS] overrideUserInterfaceStyle 부분 적용하기

    안녕하세요 코찐입니다. iOS 13 부터 다크모드가 도입되었습니다. 앱 전체를 시스템 설정에 따라 다크모드 적용한다면 별 이슈가 없을 수도 있을 것 같습니다. 하지만 제가 개발 중인 환경에서는 일부만 다크모드를 적용해서 업데이트하기로 했습니다. 그리고 시스템 설정이 아니라 앱 내부 설정에서 다크모드 변경을 제공하는 경우도 있을 겁니다. 그럴 때 유용하게 사용할 수 있는 프로퍼티가 있습니다. https://developer.apple.com/documentation/uikit/uiview/3238086-overrideuserinterfacestyle overrideUserInterfaceStyle 인데요. 상위 ViewController나 Windowr가 다크모드로 되어 있더라도, 하위 View만 라이트모..

    [Combine 책 정리] Chapter 6: Time Manipulation Operators

    안녕하세요 코찐입니다. 이번 챕터는 Time manipulation(시간 조작)에 관한 챕터입니다. 아래의 자료를 따라서 공부하고 있습니다. 하나하나 따라하기 좋게 구성되어 있습니다. https://www.raywenderlich.com/books/combine-asynchronous-programming-with-swift/v2.0 https://github.com/raywenderlich/comb-materials/tree/editions/2.0/06-time-based-operators/projects raywenderlich/comb-materials The projects and the materials that accompany the Combine: Asynchronous Programmin..