LoginSignup
0
0

More than 1 year has passed since last update.

【Swift】FSCalendar

Posted at

ライブラリ

カスタマイズ

	//ヘッダー
    fsCalendar.appearance.headerMinimumDissolvedAlpha = 0 //前月、翌月表示のアルファ量(0で非表示)
	// 水平方向(既定値)
    fsCalendar.scrollDirection = .horizontal

セルのデザイン

func calendar(_ calendar: FSCalendar, willDisplay cell: FSCalendarCell, for date: Date, at position: FSCalendarMonthPosition) {
    self.configure(cell: cell, for: date, at: position)
    // cellのデザインを変更
    // APIレスポンスの注文有効日とカレンダー上の日を比較して、同じであればセルを有効とする
}

前月、次月ボタン

    // value  前月: -1, 次月: 1 
    let date = currentCalendar.date(byAdding: .month, value: value, to:calendar.currentPage)!
    calendar.setCurrentPage(date, animated: true)

今日ボタン

    // コードから日付を選択する
    fsCalendar.select(fsCalendar.today)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0