Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 프로그래머스 문자열 붙여서 출력하기
- 연산자
- array
- 객체지향
- Til
- n번째 원소까지
- continue
- swift
- 프로그래머스 암호 해독
- 프로그래머스 배열 만들기1
- 프로그래머스 n번째 원소까지
- Error installing cocoapods
- 조건에 맞게 수열 변경하기 3
- 스페인어
- 문자열 정렬하기 (1)
- cocoapods 설치 오류
- 프로그래머스 n의 배수 고르기
- 프로그래머스 조건에 맞게 수열 변경하기 3
- 문자열 붙여서 출력하기
- 프로그래머스 최댓값 만들기(2)
- 프로그래머스 주사위 게임1
- 프로그래머스
- 배열 만들기1
- 스파르타 코딩클럽 내일배움캠프
- 스파르타코딩캠프
- 프로그래머스 문자열 정렬하기 (1)
- ruby설치
- Break
- 프로그래머스 자동커밋
- 주사위 게임1
Archives
- Today
- Total
dev._.note
[Swift] FSCalendar 라이브러리 본문
FSCalendar
달력 구현 라이브러리
https://github.com/WenchaoD/FSCalendar
GitHub - WenchaoD/FSCalendar: A fully customizable iOS calendar library, compatible with Objective-C and Swift
A fully customizable iOS calendar library, compatible with Objective-C and Swift - WenchaoD/FSCalendar
github.com
설치방법
1. 코코아팟으로 설치하기
pod init
pod 'FSCalendar'
pod install
2. SPM으로 다운로드받기
xcode 상단 File → Add Package Dependencies
검색창에 'https://github.com/WenchaoD/FSCalendar' 입력 → 하단 Add Package
FSCalendar으로 구현한 화면
사용법 주석정리
private func configureCalendarAppearance() {
// 캘린더의 로케일 설정 (한국어로 설정)
calendar.locale = Locale(identifier: "ko_KR")
// 캘린더 헤더의 날짜 형식 설정 (예: "2023.01")
calendar.appearance.headerDateFormat = "yyyy.MM"
// 캘린더 헤더의 텍스트 색상 설정
calendar.appearance.headerTitleColor = TDStyle.color.mainDarkTheme
// 요일 텍스트의 색상 설정
calendar.appearance.weekdayTextColor = .systemGray3
// 일반 날짜 텍스트의 색상 설정
calendar.appearance.titleDefaultColor = .black
// 선택된 날짜의 배경 색상 설정
calendar.appearance.selectionColor = UIColor(red: 230/255, green: 244/255, blue: 237/255, alpha: 1)
// 오늘 날짜 텍스트의 색상 설정
calendar.appearance.titleTodayColor = .black
// 오늘 날짜의 배경 색상 설정 (투명하게 설정)
calendar.appearance.todayColor = UIColor.clear
// 선택된 날짜 텍스트의 색상 설정
calendar.appearance.titleSelectionColor = UIColor.black
// 날짜 텍스트의 폰트 설정
calendar.appearance.titleFont = TDStyle.font.body(style: .regular)
// 이벤트 점의 기본 색상 설정
calendar.appearance.eventDefaultColor = TDStyle.color.mainDarkTheme
// 선택된 날짜의 이벤트 점 색상 설정
calendar.appearance.eventSelectionColor = TDStyle.color.mainDarkTheme
// 헤더의 최소 투명도 설정 (0으로 설정하여 투명도 없음)
calendar.appearance.headerMinimumDissolvedAlpha = 0.0
// 캘린더의 배경 색상 설정
calendar.backgroundColor = .white
// 이전 달로 이동하는 버튼 설정
let prevMonthButton = UIButton(type: .system)
prevMonthButton.setImage(UIImage(systemName: "chevron.left"), for: .normal)
prevMonthButton.tintColor = TDStyle.color.mainDarkTheme
prevMonthButton.addTarget(self, action: #selector(goToPreviousMonth), for: .touchUpInside)
// 다음 달로 이동하는 버튼 설정
let nextMonthButton = UIButton(type: .system)
nextMonthButton.setImage(UIImage(systemName: "chevron.right"), for: .normal)
nextMonthButton.tintColor = TDStyle.color.mainDarkTheme
nextMonthButton.addTarget(self, action: #selector(goToNextMonth), for: .touchUpInside)
// 이전 달, 다음 달 버튼을 뷰에 추가
view.addSubview(prevMonthButton)
view.addSubview(nextMonthButton)
// 이전 달 버튼의 위치 설정
prevMonthButton.snp.makeConstraints { make in
make.left.equalTo(calendar.snp.left).offset(15)
make.centerY.equalTo(calendar.calendarHeaderView.snp.centerY)
}
// 다음 달 버튼의 위치 설정
nextMonthButton.snp.makeConstraints { make in
make.right.equalTo(calendar.snp.right).offset(-15)
make.centerY.equalTo(calendar.calendarHeaderView.snp.centerY)
}
}
'Dev > SWIFT' 카테고리의 다른 글
[Swift] Mapkit 위치 검색 (0) | 2024.03.08 |
---|---|
[Swift] 앱의 생명주기 (Life Cycle) (0) | 2024.03.07 |
[Swift] SPM(Swift Package Manager)으로 SnapKit 추가하기 (0) | 2024.02.28 |
[Swift] MapKit으로 사용자 중심의 장소설정 (1) | 2024.02.27 |
[Swift] MapKit 지도 나타내기 (0) | 2024.02.26 |