richardtop / CalendarKit

📅 Calendar for Apple platforms in Swift
https://www.youtube.com/watch?v=cJ63-_z1qg8
MIT License
2.48k stars 333 forks source link

A blank area pop up after clicking cancel bar button in EKEventViewController #334

Closed kwandontcook closed 2 years ago

kwandontcook commented 2 years ago

New Issue Checklist

Issue Description

Code I'm using with CalendarKit

<!-- INSERT CODE HERE -->
func dayViewDidSelectEventView(_ eventView: EventView) {
        guard let v = eventView.descriptor as? Event else{
            return;
        }

        let ek_event = EKEvent(eventStore: self.eventStore)
        ek_event.startDate = v.dateInterval.start
        ek_event.endDate = v.dateInterval.end
        ek_event.notes = ""
        ek_event.title = v.text
        ek_event.calendar =  self.eventStore.defaultCalendarForNewEvents
        ek_event.calendar.cgColor = v.color.cgColor

        let vc = EKEventViewController()
        vc.event = ek_event
        vc.allowsCalendarPreview = true
        vc.allowsEditing = true
        self.navigationController?.pushViewController(vc, animated: true)

    }

This is the code that I wrote for the EKEventViewController. (The codes works well, I can go to EKEventViewController with correct dataSet). However, after clicking the return button, there is an blank area in the parentView (DayViewController)

Is it determined as a bug? (No idea about that)

P.S: I am using IOS 15.0 to develop the application

Result I am trying to achieve

StackOverflow Question link

richardtop commented 2 years ago

Looks like you're adding a new event but the code is placed to the dayViewDidSelectEventView and should be to dayViewDidLongPressTimeline