-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Pod not working correctly #14
Comments
I know how to avoid it, but don't know how to fix - do not use autolayout.
С уважением, |
Thanks for the quick reply. Does this also happen when using ABCalendarPicker as a static library? |
Yes, same problem also happen. Contribute if you'll find a way to fix it.
С уважением, |
I got the same problem when I created my test project with storyboard. No solution yet? |
Just turn off autolayout in storyboard or help us to fix another way :)
|
Check your constraints. I used it (not via pods, but a git submodule, and without storyboard). Added a height constraint on the whole ABCalendarView, and I change the constant value of the constraint every time the delegate reports a height change, and everything works fine. |
@GreatWiz do you know how to make this backward compatible with iOS 5 or maybe 4? |
This issue happens because the ABCalendarPicker UIView is instantiated before the actual bounds of the view are set by autolayout (all the bounds are set once viewDidLayoutSubviews executes in your viewcontroller). Just to trace out the issue:
Basically, both the gradientBar and the mainTileView get setup with incorrect sizes/positions. The wise thing to do, would be to reimplement layoutSubviews (without calling [super layoutSubviews] to avoid autolayout messing with things) and check if the bounds have changed, and if so, update everything. Alternatively, just override layoutSubviews in ABCalendarPicker.m with an empty implementation (so that autolayout doesn't attempt to layout the controls inside that view), and instead of adding the ABCalendarPicker view with IB, add it programmatically in your view controller by using the initWithFrame constructor, that way the picker knows it's size and is able to setup everything correctly the first time. self.calendarPicker = [[ABCalendarPicker alloc] initWithFrame:CGRectMake(0, 0, 320, 240)];
self.calendarPicker.delegate = self;
self.calendarPicker.dataSource = self;
[self.view addSubview:self.calendarPicker]; |
if we allocate with initwith frame its working fine for me.. |
I finally got some time to try ABCalendarPicker (the CocoaPods version). However, I'm experiencing something that may not be intended behavior.
I tried a minimalistic approach, just like the one in the demo. As screenshots may tell more than words:
Right after starting the App:
Hitting "Today" ([self.calendarPicker setDate:[NSDate date] andState:ABCalendarPickerStateDays animated:YES];) leads to the following:
Hitting "Today" again.. this seems to be almost "right", but there is still an empty row.
I hope this is enough to reproduce this bug.
The text was updated successfully, but these errors were encountered: