Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there a way to indicate days, which can't be selected, with regular selector shape of different color? #239

Closed
dantetemp opened this issue Mar 25, 2016 · 7 comments

Comments

@dantetemp
Copy link

No description provided.

@dantetemp
Copy link
Author

... or make text for those dates faded?

@WenchaoD
Copy link
Owner

Hi there. You can just call calendar.selectDate() for you unselectable date. In the calendar, can't be selected means can't be tapped, but selecting with function is not disabled. You can configure the shape and color of your disabled dates with FSCalendarDelegateAppearance by giving them special selection colors.

@dantetemp
Copy link
Author

hi again. i managed to add borders for specific unselectable cells by using this code

    func calendar(calendar: FSCalendar!, appearance: FSCalendarAppearance, borderDefaultColorForDate date: NSDate!) -> UIColor {
        if self.datesUsed.contains(date) {
            return UIColor.grayColor().colorWithAlphaComponent(0.5)
        }
        return UIColor.blackColor().colorWithAlphaComponent(0)
    }

    func calendar(calendar: FSCalendar!, shouldSelectDate date: NSDate!) -> Bool {
        if self.datesUsed.contains(date) {
            print("date is not selectable")
            return false
        }
        return true
    }

as a result i got this

https://s14.postimg.org/kn03knx35/Screen+Shot+2016-03-26+at+09.08.01.png

the only thing missing is changing fill color of those disabled days (17, 24, 25). is it possible?

@dantetemp
Copy link
Author

i also noticed the date number is not perfectly centered inside the circles. hopefully that is something that you can fix.

@WenchaoD
Copy link
Owner

  1. About changing fill color of those disabled days
    1. call calendar.selectDate to your disabled date. Yes you can do that.
    2. use - (UIColor *)calendar:(FSCalendar *)calendar appearance:(FSCalendarAppearance *)appearance selectionColorForDate:(NSDate *)date function of FSCalendarDelegateAppearance to manager the color of the disabled dates. Please download the example to see the full usage.
  2. About the vertical offset of the day text.
    1. As you can change the font of the day text, the baseline of the font might be different. So the vertical offset of the day text might be different for different font.
    2. If you really want to adjust the y position of the text, use calendar.appearance.titleVerticalOffset and calendar.appearance.subtitleVerticalOffset to adjust it by yourself.

Thanks.

@dantetemp
Copy link
Author

thank you!

@patelhari
Copy link

No Progress Still Same Issue exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants