Git Product home page Git Product logo

Comments (21)

MosheBerman avatar MosheBerman commented on June 2, 2024

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.

MosheBerman avatar MosheBerman commented on June 2, 2024

Are you using CKCalendarView or CKCalendarViewController?

from mbcalendarkit.

ed-parry avatar ed-parry commented on June 2, 2024

I'm using CKCalendarView on a standard UIView, which has both a NavigationController and TabViewController on it. Thanks for the reply!

from mbcalendarkit.

MosheBerman avatar MosheBerman commented on June 2, 2024

Looking now. It's been a while...

from mbcalendarkit.

MosheBerman avatar MosheBerman commented on June 2, 2024

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.

MosheBerman avatar MosheBerman commented on June 2, 2024

PS: As a short term hack, try setting the center property and see what happens.

from mbcalendarkit.

ed-parry avatar ed-parry commented on June 2, 2024

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.

ed-parry avatar ed-parry commented on June 2, 2024

...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.

MosheBerman avatar MosheBerman commented on June 2, 2024

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.

ed-parry avatar ed-parry commented on June 2, 2024

No problem - thanks for pointing me in the right direction!

from mbcalendarkit.

nagi avatar nagi commented on June 2, 2024

Setting the bar to Opaque fixed it for me:

screen shot 2014-03-21 at 11 24 19

from mbcalendarkit.

FlorianBasso avatar FlorianBasso commented on June 2, 2024

I fixed this issue by setting my navigationBar.translucent to NO.

from mbcalendarkit.

MosheBerman avatar MosheBerman commented on June 2, 2024

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.

MosheBerman avatar MosheBerman commented on June 2, 2024

The correct fix is to use the topLayoutGuide, to offset the calendar, iirc.

from mbcalendarkit.

4tress avatar 4tress commented on June 2, 2024

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.

MosheBerman avatar MosheBerman commented on June 2, 2024

@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.

MosheBerman avatar MosheBerman commented on June 2, 2024

How are we all doing with this?

from mbcalendarkit.

griffind avatar griffind commented on June 2, 2024

I fixed this by adding

calendar.frame = CGRectOffset(self.view.frame, 0.0, 65.0);

to the viewDidLoad

from mbcalendarkit.

bendparker avatar bendparker commented on June 2, 2024

I'm still experiencing it...using griffind's solution for now.

from mbcalendarkit.

bendparker avatar bendparker commented on June 2, 2024

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.

MosheBerman avatar MosheBerman commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.