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

Defining constraints of calendar view #11

Open
daisyramos317 opened this issue Feb 29, 2016 · 12 comments
Open

Defining constraints of calendar view #11

daisyramos317 opened this issue Feb 29, 2016 · 12 comments

Comments

@daisyramos317
Copy link

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

@nbwar
Copy link
Owner

nbwar commented Feb 29, 2016

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?

@daisyramos317
Copy link
Author

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

@nbwar
Copy link
Owner

nbwar commented Feb 29, 2016

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.

@daisyramos317
Copy link
Author

Ok I tried

var calendarView: NWCalendarView = NWCalendarView()

it looks like the calendar isn't populated

@nbwar
Copy link
Owner

nbwar commented Feb 29, 2016

You have to call calendarView.createCalendar()

@daisyramos317
Copy link
Author

Yes I have this as well

@nbwar
Copy link
Owner

nbwar commented Feb 29, 2016

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

@daisyramos317
Copy link
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.

@daisyramos317
Copy link
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 :(

@ghost
Copy link

ghost commented Mar 9, 2016

I too was wondering how to fix the auto layout issue,

daisyramos317, did you manage to fix this, if so can you please share?

@nbwar
Copy link
Owner

nbwar commented Mar 9, 2016

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@nbwar @daisyramos317 and others