Comments (21)
This is caused because of a change in iOS 7's full screen paradigm. I thought I had fixed this, but I'll take a look in a particular project that uses it and see if I can find the fix I applied there. Give me a few minutes please.
from mbcalendarkit.
Are you using CKCalendarView
or CKCalendarViewController
?
from mbcalendarkit.
I'm using CKCalendarView
on a standard UIView
, which has both a NavigationController
and TabViewController
on it. Thanks for the reply!
from mbcalendarkit.
Looking now. It's been a while...
from mbcalendarkit.
Ah, so I see what's going on here. If you poke around inside of CKCalendarView.m
, you'll find that the setters for the calendar view's frame are overridden so that the calendar view is stuck to the top of the screen. (Look at setFrame:
, setFrame:animated: and
_rectForDisplayMode:`.)
In iOS 6, this wasn't an issue, because the navigation bar occupied the top of the display. For iOS 7, I made some changes to the CKCalendarViewController
class and all was well... Or so I thought. It seems I forgot this case.
Solutions I'm considering:
- Changing the way frames are set, so that the calendar view has an "origin" property. The
setFrame:
and related methods would then query the origin when building a frame. - Emulating UIPickerView and allowing you to set whatever frame you want, but ignoring the height and width of the frame. This is similar to the other option, except the API is perhaps simpler and arguably more correct for emulating Apple.
What do you think?
from mbcalendarkit.
PS: As a short term hack, try setting the center
property and see what happens.
from mbcalendarkit.
I'm sorry, I'm relatively new to Objective-C, so I'm not positive on the best long-term resolution for it. However, the second solution of emulating the UIPickerView
strikes me as the best option of the two.
Setting the center
property didn't have any effect on it for me. As a solution for myself now, I pushed the main frame
down by 64-pixels, in the - (void)layoutSubviewsAnimated:(BOOL)animated
method (line 243 of CKCalendarView.m
):
- (void)layoutSubviewsAnimated:(BOOL)animated
{
/* Enforce view dimensions appropriate for given mode */
CGRect frame = CGRectMake(0, 64, 0, 0); //[self _rectForDisplayMode:[self displayMode]];
//CGPoint origin = [self frame].origin;
//frame.origin = origin;
[self setFrame:frame animated:animated];
...
}
from mbcalendarkit.
...although my solution also requires you to add 64-pixels to the tableFrame
, done on line 272 of CKCalendarView.m
:
tableFrame.origin.y += [self frame].size.height + 64;
from mbcalendarkit.
Interesting... That's right, the tableFrame needs to be shifted. Don't forget to remove that same value from the bottom though. (The height property may be 64 pixels too long.)
As general practice, you're not supposed to hard code values, but instead use a dynamically calculated value. As I said, I really need to get working on this, but thanks for pointing out the issues and your tentative solution.
from mbcalendarkit.
No problem - thanks for pointing me in the right direction!
from mbcalendarkit.
Setting the bar to Opaque fixed it for me:
from mbcalendarkit.
I fixed this issue by setting my navigationBar.translucent to NO.
from mbcalendarkit.
That makes sense, because iOS 7 will stretch views to the full height of the screen if the navigation bar is translucent. If you want to keep a translucent bar, look at the preceding discussion, for now.
from mbcalendarkit.
The correct fix is to use the topLayoutGuide
, to offset the calendar, iirc.
from mbcalendarkit.
The correct fix is to count tableFrame.origin.y
like this: tableFrame.origin.y += ([self frame].size.height + [self frame].origin.y);
, according not only to the calendar frame height, but also its y position delta.
from mbcalendarkit.
@4tress, Ah, for the table offset, yes. I'd suggest using the CGGeometry macros, though. (CGRectGetMaxY(self.calendar.frame)
etc...)
I've got my hands full at the moment, but I do intend to work on a fix for this.
from mbcalendarkit.
How are we all doing with this?
from mbcalendarkit.
I fixed this by adding
calendar.frame = CGRectOffset(self.view.frame, 0.0, 65.0);
to the viewDidLoad
from mbcalendarkit.
I'm still experiencing it...using griffind's solution for now.
from mbcalendarkit.
Would be nice to have it fixed, but the work around is okay for now.
Also--I can't seem to initiate an instance of class CKCalendarViewControllerInternal, do I need to import another file for that?
from mbcalendarkit.
The internal view controller needs to be imported separately. It's imported in the public version of the view controller, which subclasses UINavigationController instead of UIViewController. It's otherwise the same thing.
from mbcalendarkit.
Related Issues (20)
- Bring `CustomCellProvider` to the HeaderView
- Cell Transition Animation Bug HOT 1
- Unit Test Cell Width Code
- CalendarView doesn't take in account firstDayOfWeek HOT 10
- Disable dragging on CustomCellProviding HOT 5
- Performance Profiling HOT 1
- Allow Custom Next/Back Images
- Month to Week Transition observable gap
- how refresh the data HOT 1
- how avoid show the tab bar HOT 1
- how to use background color in every sunday?
- Hello Project's Owner
- How to show more than one event in single date for MBCalendarKit for swift 4 HOT 1
- Changed it to NSCalendarIdentifierIslamic not working
- How to achieve calendar color customization? HOT 1
- How to change colors of calendar header, arrows, and selected cell?
- How to hide rows in Month display mode.
- Installing mBCalendarKit via Cocoapods is getting failed. HOT 1
- Calendar week view - pressing forwards/backwards buttons sometimes skips a week
- Tab Bar Text...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbcalendarkit.