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

How to set currentDate to show selected month calendar #7

Open
avocet opened this issue Sep 13, 2012 · 21 comments
Open

How to set currentDate to show selected month calendar #7

avocet opened this issue Sep 13, 2012 · 21 comments

Comments

@avocet
Copy link

avocet commented Sep 13, 2012

Sorry, I don't know how to set currentDate in PMDaysView ?
[PMCalendarController setCurrentDate: ] is right to set currentDate ?

@kovpas
Copy link
Owner

kovpas commented Sep 13, 2012

Yes.

-Pavel

On Sep 13, 2012, at 7:04 PM, avocet [email protected] wrote:

Sorry, I don't know how to set currentDate in PMDaysView ?
[PMCalendarController setCurrentDate: ] is right to set currentDate ?


Reply to this email directly or view it on
GitHubhttps://github.com//issues/7.

@avocet
Copy link
Author

avocet commented Sep 14, 2012

But I can't do it in my codes!
as in picture below,
https://picasaweb.google.com/lh/photo/AEnbhkFjd_tROED6kCTNMdMTjNZETYmyPJy0liipFm0?feat=directlink

@kovpas
Copy link
Owner

kovpas commented Sep 14, 2012

Looks like another thing which is missing, yes. Will look into this when I have enough time.

Thanks.

@kemalserkan
Copy link

Hi
I added the project to my project. I can show the calendar but when I pressed the next or previous month button I get this message;
I cant show the next or previous month of the year...

[__NSDate monthStartDate]: message sent to deallocated instance what can I do for this...
Please help me...

This is my code

self.pmCC = [[PMCalendarController alloc] initWithThemeName:@"default"];
pmCC.delegate = self;
pmCC.mondayFirstDayOfWeek = NO;
[pmCC presentCalendarFromRect:CGRectZero
inView:[self.view superview]
permittedArrowDirections:PMCalendarArrowDirectionAny
animated:YES];
[self calendarController:pmCC didChangePeriod:pmCC.period];

@kovpas
Copy link
Owner

kovpas commented Sep 18, 2012

Hi,

Have you tried to run enclosed demo project? Does it work?

@kemalserkan
Copy link

Yes demo is working correctly...

@kemalserkan
Copy link

I call the calender from a UIBarButton is that affect ?

@kovpas
Copy link
Owner

kovpas commented Sep 18, 2012

Not sure. Obviously NSDate object is being released somewhere in an incorrect place, but I don't see anything wrong in your code.

@kemalserkan
Copy link

Ok I will look is there another NSDate object that released.. Thank you so much...

@kemalserkan
Copy link

There is NSDate object that I take the currentDate to use another function. But I dont release any of that object. :(

@kemalserkan
Copy link

Language can affect this error. I am from Türkiye.

@kemalserkan
Copy link

In PMCalendarView.m file

in - (void)drawRect:(CGRect)rect function

NSDate *dateOnFirst = [_currentDate monthStartDate]; on this row throw this error

-[__NSDate monthStartDate]: message sent to deallocated instance 0xacbe060

When I pressed the next or previous month...

@kovpas
Copy link
Owner

kovpas commented Sep 18, 2012

That's weird. currentDate has a strong reference, it shouldn't be released.

@kemalserkan
Copy link

Is there any solution we can do

@kovpas
Copy link
Owner

kovpas commented Sep 18, 2012

To be honest, I have no idea what could be wrong in the code you've wrote.
As long as demo project works, I assume that the problem is on your side.

-Pavel

On Sep 18, 2012, at 12:58 PM, Kemal Serkan YILDIRIM <
[email protected]> wrote:

Is there any solution we can do


Reply to this email directly or view it on
GitHubhttps://github.com//issues/7#issuecomment-8649881.

@kemalserkan
Copy link

Thank you so much

@rinonita
Copy link

rinonita commented Dec 6, 2012

if Objective-C ARC set to NO, error
In PMCalendarView.m file

in - (void)drawRect:(CGRect)rect function

NSDate *dateOnFirst = [_currentDate monthStartDate]; on this row throw this error

-[__NSDate monthStartDate]: message sent to deallocated instance 0xacbe060

@kovpas
Copy link
Owner

kovpas commented Dec 6, 2012

ARC is supposed to be turned on.

@kemalserkan
Copy link

[__NSDate numberOfDaysInMonth]: message sent to deallocated instance 0x32072ff0

I try again to add PMCalendar to my project..

I get that message...

@kovpas
Copy link
Owner

kovpas commented Feb 13, 2013

If you find a way to fix that, please make a pull request.

@mchbaro
Copy link

mchbaro commented Sep 12, 2013

to solve this problem just replace
NSDateComponents *eComponents = [gregorian components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit fromDate:_currentDate];
with
NSDateComponents *eComponents = [gregorian components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit fromDate:[_currentDate copy]];

pmcalendarview.m

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

5 participants