Skip to content

Defining constraints of calendar view #11

Open

Description

@daisyramos317

Where do you define the constraints for the month/weekly view?

If you take a look here, Saturday is cut off.
image

Also how can I set a selected date to stay selected? unless it's tapped twice to deselect in order to allow the user to select multiple dates that aren't consecutive. I noticed there is a delegate for NWCalendarDayViewDelegate, perhaps there?

Thanks!
Great library by the way

Activity

  1. nbwar commented on Feb 29, 2016

    @nbwar
    Owner

    I calculate the column widths here https://github.com/nbwar/NWCalendarView/blob/master/NWCalendar/NWCalendarMonthView.swift#L184

    Are you using Autolayout to set the width and height of the calendar?

  2. daisyramos317 commented on Feb 29, 2016

    @daisyramos317
    Author

    Yes using Autolayout
    I set the constraints to (0, 64, 414, 383)

  3. nbwar commented on Feb 29, 2016

    @nbwar
    Owner

    It sounds look an Autolayout issue. The reason saturday is not seen is because when the column widths are calculated the ViewController is larger so the columns are though to larger. Try creating the calendar by code and see if that fixes your problem.

  4. daisyramos317 commented on Feb 29, 2016

    @daisyramos317
    Author

    Ok I tried

    var calendarView: NWCalendarView = NWCalendarView()

    it looks like the calendar isn't populated

  5. nbwar commented on Feb 29, 2016

    @nbwar
    Owner

    You have to call calendarView.createCalendar()

  6. daisyramos317 commented on Feb 29, 2016

    @daisyramos317
    Author

    Yes I have this as well

  7. nbwar commented on Feb 29, 2016

    @nbwar
    Owner

    I would have to see more code to figure out the issue. Does the example work for you?

  8. daisyramos317 commented on Feb 29, 2016

    @daisyramos317
    Author

    This is how I've declared it programatically:

    var calendarView: NWCalendarView = NWCalendarView()
    calendarView.frame = CGRectMake(0, 64, 414, 383)
    view.addSubview(calendarView)

    The example works fine, it does seem to be an autolayout issue as I increased the width and height.

  9. daisyramos317 commented on Feb 29, 2016

    @daisyramos317
    Author

    Actually I reverted back to using the calendar through IBOutlet and disabled autolayout for this view

    calendarView.translatesAutoresizingMaskIntoConstraints = true

    doesn't seem to solve it :(

  10. nbwar commented on Mar 9, 2016

    @nbwar
    Owner

    Can you give me steps to reproduce or a sample project with the bugs you are experiencing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions