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

Change particular date colour & add events on particular dates . #275

Closed
gabhisekdev opened this issue Apr 20, 2016 · 16 comments
Closed

Change particular date colour & add events on particular dates . #275

gabhisekdev opened this issue Apr 20, 2016 · 16 comments

Comments

@gabhisekdev
Copy link

Hey congrats for such a beautiful library. I have 2 arrays as - eventDateArray consisting event NSDates & another array as colouredDateArray having NSDate's to be coloured. How can I achieve the same ? Please reply.

@WenchaoD
Copy link
Owner

Hi @GABHISEKBUNTY Please download the example and view the 'delegate appearance example'.

@gabhisekdev
Copy link
Author

gabhisekdev commented Apr 22, 2016

For any future users in SWIFT wanting such functionality. Changing colour of particular dates -(take 2 array - prsentStudents - greenColor & absentStudents - redColor)

self.presentDatesArray = ["2016-04-03",
        "2016-04-06",
        "2016-04-12",
        "2016-04-25"];

        self.absentDatesArray = ["2016-04-10",
            "2016-04-18",
            "2016-04-15",
            "2016-04-16"];


    func calendar(calendar: FSCalendar!, appearance: FSCalendarAppearance!, titleDefaultColorForDate date: NSDate!) -> UIColor!
    {
        let dateString: String = calendar.stringFromDate(date, format: "yyyy-MM-dd")


        if presentDatesArray.containsObject(dateString)
        {
            return UIColor.greenColor()
        }
        else if absentDatesArray.containsObject(dateString)
        {
            return UIColor.redColor()
        }
        else
        {
            return nil
        }
    }



But be sure to implement - FSCalendarDelegateAppearance

@WenchaoD
Copy link
Owner

👍

@saravanaPluggdd
Copy link

How to get Month and all Months from calendar?

@saravanaPluggdd
Copy link

How to Change particular date color for dates from array get from Json Parsing?

@saravanaPluggdd
Copy link

How to Change particular date color for dates from array get from Json Parsing at Calendar launching?

@gabhisekdev
Copy link
Author

The code is given right above.

@sandeep34
Copy link

how can i do the same task in objective c. green color for present students and redcolor for absent students.

Thanks.

@gabhisekdev
Copy link
Author

@anooj1483 Please update to the latest pod. This issue has been fixed

@gabhisekdev
Copy link
Author

@sandeep34 Bro, I think u can translate the code to obj C. It also works for obj C as well

@BugFinder27
Copy link

BugFinder27 commented May 23, 2017

@GABHISEKBUNTY Hi Abhisek I'm trying to implement your code using swift 3 but its not working . its not showing any error but no effects of colors. I want exactly like your code but the only problem in my case is these attendence are coming from json. please help me through this. thanks abhi in advance :)

@IOSDeveloperProgrammer
Copy link

@GABHISEKBUNTY @BugFinder27 Hi my problem is same. please share some example and etc.. please help me out of this solution. Thanking you

@Hitesh-mor
Copy link

Hi Team,

My problem is I want to change the selection colour for particular dates and for other dates it can be any

how can I achieve this with this library
Thank you

@Neeraj204
Copy link

Any success after json parsing?

@awais-ijaz-brainx
Copy link

You just have to reload the data afer json parsing .. as calendar.reloadData()

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

11 participants