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

How to get month name in month view? #300

Open
BhavinBhadani opened this issue Nov 29, 2022 · 7 comments
Open

How to get month name in month view? #300

BhavinBhadani opened this issue Nov 29, 2022 · 7 comments

Comments

@BhavinBhadani
Copy link

I have few questions regarding Month View setup.

  1. How to know month name when we scrolled horizontally with paging enable and how to get update about the month change?
  2. Can we have both vertical and horizontal separator in month view?
  3. How to show stripes instead of dots for events?
  4. Can we configure selection that is of square only rather than circle?
@kvyatkovskys
Copy link
Owner

Hello @BhavinBhadani!

  1. calendar style settings
style.month.scrollDirection = .horizontal
style.month.isPagingEnabled = true
style.month.autoSelectionDateWhenScrolling = true
  1. You can create your own custom cell to monthView (2, 3, 4)

@BhavinBhadani
Copy link
Author

BhavinBhadani commented Dec 1, 2022

@kvyatkovskys Thanks for the reply. I am trying to use xib for the collection view cell like below but it isn't working and crashed when trying to get properties from cell.

     if type == .month {
        (view as? UICollectionView)?.register(TaskEventDateCell.self,
                                              forCellWithReuseIdentifier: "TaskEventDateCell")
        let cell = (view as? UICollectionView)?.kvkDequeueCell(indexPath: indexPath) { (cell: TaskEventDateCell) in
            // configure the cell
            if let day = parameter.date?.kvkDay {
                cell.dateLabel.text = "\(day)"
            }
            
            print("Date: \(parameter.date?.kvkDay)")
        }
        return cell
    }

Also, is there any delegate to know which month it is when we changes a month?

@kvyatkovskys
Copy link
Owner

@kvyatkovskys Thanks for the reply. I am trying to use xib for the collection view cell like below but it isn't working and crashed when trying to get properties from cell.

     if type == .month {
        (view as? UICollectionView)?.register(TaskEventDateCell.self,
                                              forCellWithReuseIdentifier: "TaskEventDateCell")
        let cell = (view as? UICollectionView)?.kvkDequeueCell(indexPath: indexPath) { (cell: TaskEventDateCell) in
            // configure the cell
            if let day = parameter.date?.kvkDay {
                cell.dateLabel.text = "\(day)"
            }
            
            print("Date: \(parameter.date?.kvkDay)")
        }
        return cell
    }

Also, is there any delegate to know which month it is when we changes a month?

  • just subscribe on this func willSelectDate(_ date: Date, type: CalendarType)
  • can you provide crash log, pls? I'll try to investigate...

@BhavinBhadani
Copy link
Author

BhavinBhadani commented Dec 2, 2022

@kvyatkovskys Thanks again. let me send you view hierarchy for better understanding because I got a crash for outlets which already attached. Double checked few times and even used a new cell xib as well. In view hierarchy I don't even get content view.

Screenshot 2022-12-02 at 2 38 54 PM

and here is how TaskEventDateCell looks like
Screenshot 2022-12-02 at 2 40 02 PM

@kvyatkovskys
Copy link
Owner

@kvyatkovskys Thanks again. let me send you view hierarchy for better understanding because I got a crash for outlets which already attached. Double checked few times and even used a new cell xib as well. In view hierarchy I don't even get content view.

Screenshot 2022-12-02 at 2 38 54 PM

and here is how TaskEventDateCell looks like

Screenshot 2022-12-02 at 2 40 02 PM

Hmm, will try to reproduce. Can you send the crash log, pls?

@BhavinBhadani
Copy link
Author

BhavinBhadani commented Dec 7, 2022

@kvyatkovskys Regarding crash log, it just says that property outlet is nil as we don't have anything in hierarchy as you can see in above pic.

  Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

As you can see outlets are properly attached as well
Screenshot 2022-12-07 at 8 46 47 AM

And one more question, how we can hide inbound and outbound dates from custom cell? As you can see in a below video, the outbound dates to be shown when we scroll a little bit. And one more issue is when we change calendar cell size based on weeks in a month, whole layout just shattered.

Screen.Recording.2022-12-08.at.5.19.09.PM.mov

@kvyatkovskys
Copy link
Owner

I can't reproduce the issue with dates on month view... about the xib file, try to create a cell from code

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

2 participants