How can i select dates programmatically and show on FSCalendar

10,736

If you want to select date then below method will be helpful, where calendar is outlet of FSCalendar.

calendar.select(calendar.today)

And if you want to select multiple dates then the best way would be to use event dots, and that can be possible through below delegate method of FSCalendar Data source,

func calendar(_ calendar: FSCalendar, numberOfEventsFor date: Date) -> Int { //number of dots you want to show }

or if you really want to show dates selected, you can use below method smartly and returning different colours for dates that you want to select,

    public func calendar(_ calendar: FSCalendar, appearance: FSCalendarAppearance, fillDefaultColorFor date: Date) -> UIColor?
{
    if your date
    {
         //return the colour for your dates
    }
    else
    {
         //return default colour
    }
}

Hope, this answer helps you.

Share:
10,736

Related videos on Youtube

slytrkmn
Author by

slytrkmn

Updated on June 04, 2022

Comments

  • slytrkmn
    slytrkmn almost 2 years

    I used FSCalendar(https://github.com/WenchaoD/FSCalendar) in my project. If user click repeat button, the events repeats everyday. I want to show it on calendar which is in my application. How can I do it?

  • slytrkmn
    slytrkmn about 7 years
    I dont want to give an notification, I want to show on calendar which is in my application. I use FSCalendar. github.com/WenchaoD/FSCalendar.
  • Surjeet Rajput
    Surjeet Rajput about 7 years
    your problem is how to display it in calendar...?
  • Surjeet Rajput
    Surjeet Rajput about 7 years
    FSCalendar have a method calendar(calendar: FSCalendar, didSelectDate date: NSDate) on selection you can display it or you can simply do it using tableView.Display your reminder in tableview.
  • teja_D
    teja_D over 5 years
    Make sure you confirm FSCalendarDelegateAppearance :)
  • Bhanuteja
    Bhanuteja over 4 years
    And if we want to deselect them, it will create problem