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

Event text cutoff in timeline view for short events #347

Closed DevonAllary closed 1 year ago

DevonAllary commented 1 year ago

New Issue Checklist

Issue Description

Is there any way to increase the size of the hour blocks in the calendar day view or to adjust the position of the text inside the event? With short events (around 15 minutes) the event text gets cut off, even with small sized font.

Screen Shot 2022-09-03 at 10 27 51 AM

Code I'm using with CalendarKit

I tried using the fix recommended in #236 but it's not working.


override func viewDidLoad() {
        super.viewDidLoad()
        title = "Calendar"
        self.dayView.autoScrollToFirstEvent = true
        var style = CalendarStyle()
        style.timeline.verticalInset = 90
        updateStyle(style)
}

Result I am trying to achieve

I'd like to either increase the size of the hour blocks or adjust the positioning of the text box inside the event so that the text doesn't get cutoff.

richardtop commented 1 year ago

This is in fact should work. I'll check and get back to you. Let's keep this open as a bug.

richardtop commented 1 year ago

Please, use vertifalDiff property instead:

  override func viewDidLoad() {
    super.viewDidLoad()
    title = "CalendarKit Demo"
    navigationController?.navigationBar.isTranslucent = false
    dayView.autoScrollToFirstEvent = true
    reloadData()
    var style = CalendarStyle()
    style.timeline.verticalDiff = 90
    updateStyle(style)
  }

This code works perfectly:

Before

Simulator Screen Shot - iPhone 14 Pro Max - 2022-09-20 at 22 31 50

After

Simulator Screen Shot - iPhone 14 Pro Max - 2022-09-20 at 22 33 13

Feel free to close this issue if it solves your problem.