{"action":"opened","issue":{"url":"https://api.github.com/repos/patchthecode/JTAppleCalendar/issues/831","repository_url":"https://api.github.com/repos/patchthecode/JTAppleCalendar","labels_url":"https://api.github.com/repos/patchthecode/JTAppleCalendar/issues/831/labels{/name}","comments_url":"https://api.github.com/repos/patchthecode/JTAppleCalendar/issues/831/comments","events_url":"https://api.github.com/repos/patchthecode/JTAppleCalendar/issues/831/events","html_url":"https://github.com/patchthecode/JTAppleCalendar/issues/831","id":342747936,"node_id":"MDU6SXNzdWUzNDI3NDc5MzY=","number":831,"title":"Selected cells not appearing properly after scrolling.","user":{"login":"tripathishivam35","id":13601158,"node_id":"MDQ6VXNlcjEzNjAxMTU4","avatar_url":"https://avatars1.githubusercontent.com/u/13601158?v=4","gravatar_id":"","url":"https://api.github.com/users/tripathishivam35","html_url":"https://github.com/tripathishivam35","followers_url":"https://api.github.com/users/tripathishivam35/followers","following_url":"https://api.github.com/users/tripathishivam35/following{/other_user}","gists_url":"https://api.github.com/users/tripathishivam35/gists{/gist_id}","starred_url":"https://api.github.com/users/tripathishivam35/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tripathishivam35/subscriptions","organizations_url":"https://api.github.com/users/tripathishivam35/orgs","repos_url":"https://api.github.com/users/tripathishivam35/repos","events_url":"https://api.github.com/users/tripathishivam35/events{/privacy}","received_events_url":"https://api.github.com/users/tripathishivam35/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-19T14:17:29Z","updated_at":"2018-07-19T14:17:29Z","closed_at":null,"author_association":"NONE","body":"I am facing a issue which is illustrated from below provided screenshots:\r\nImage 1: Single Cell is selected from CollectionView -\r\n![img_7157](https://user-images.githubusercontent.com/13601158/42947557-31346372-8b8b-11e8-866b-57377c63d6d8.png)\r\n\r\n\r\nImage 2: After scrolling few cells top to bottom and coming back again to Top. Selected Cell state is like this now without any further selections.\r\n![img_7159](https://user-images.githubusercontent.com/13601158/42947705-89c8e4ae-8b8b-11e8-952d-1a81c88d190a.png)\r\n\r\n*******************\r\nRelated Code with Cell Selection is like this below -\r\n\r\n```\r\n    func handleCellConfiguration(cell: JTAppleCell?, cellState: CellState) {\r\n        handleCellSelection(view: cell, cellState: cellState)\r\n    }\r\n\r\n    // Function to handle the calendar selection\r\n\r\n    func handleCellSelection(view: JTAppleCell?, cellState: CellState) {\r\n        \r\n        guard let myCustomCell = view as? CalenderCell else {return }\r\n        \r\n        if cellState.isSelected {\r\n            myCustomCell.containerView.layer.cornerRadius =  10\r\n            myCustomCell.containerView.backgroundColor = UIColor.init(red: 0.26, green: 0.10, blue: 0.39, alpha: 1.0)\r\n        } else {\r\n            myCustomCell.containerView.layer.cornerRadius =  0\r\n            myCustomCell.containerView.backgroundColor = UIColor.clear\r\n        }\r\n    }\r\n    \r\n```\r\n\r\n ```\r\n   func calendar(_ calendar: JTAppleCalendarView, willDisplay cell: JTAppleCell, forItemAt date: Date, cellState: CellState, indexPath: IndexPath) {\r\n        \r\n        let myCustomCell = cell as! CalenderCell\r\n        sharedFunctionToConfigureCell(myCustomCell: myCustomCell, cellState: cellState, date: date)\r\n    }\r\n\r\n    \r\n    func sharedFunctionToConfigureCell(myCustomCell: CalenderCell, cellState: CellState, date: Date) {\r\n        \r\n        handleCellConfiguration(cell: myCustomCell, cellState: cellState)\r\n    }\r\n    \r\n    func calendar(_ calendar: JTAppleCalendarView, didDeselectDate date: Date, cell: JTAppleCell?, cellState: CellState) {\r\n        handleCellConfiguration(cell: cell, cellState: cellState)\r\n        \r\n    }\r\n    \r\n    func calendar(_ calendar: JTAppleCalendarView, didSelectDate date: Date, cell: JTAppleCell?, cellState: CellState) {\r\n        handleCellConfiguration(cell: cell, cellState: cellState)\r\n}\r\n\r\n```\r\n\r\nCould u tell what wrong I am doing here. How to maintain the State of Selected Cells?"}}
{"actor":{"display_login":"tripathishivam35"}}