iOS: Disable past dates in the tapku library calendar - iphone

I am looking for how to disable past dates in the tapku calendar.
For instance, I want to disable all dates before the current date.
Is there any reference?
Regards,
João Paulo

I don't know of any official documentation, but I assume that you should modify the array you use as your datasource for the calendar view, possibly on - (void)viewDidAppear in your implementation.
For example, let's say you have an NSArray of events, with each array object containing an NSDictionary for the date of that event. You should iterate through the array when the view loads, comparing each item to the current date, which can be found using something like:
CFGregorianDate currentDate = CFAbsoluteTimeGetGregorianDate(CFAbsoluteTimeGetCurrent(), CFTimeZoneCopySystem()); - link to this here: How do I get the current date in Cocoa (second answer)
You can either save the modifications to a new array, or just change the old array, so long as it's mutable. From there, all you need to do is pop that new array into your:
- (NSArray*)calendarMonthView:(TKCalendarMonthView *)monthView marksFromDate:(NSDate *)startDate toDate:(NSDate *)lastDate method, and Tapku will take care of the rest!

Related

A way for static "now" in google sheet?

I would like to insert a formula with a checklist. That is, when I check the checklist, I want the date and time when I did it to appear in the cell next to it. Obviously, however, the "now" formula is updated with each click of the checklists, and I want the date when I checked it to remain. How can I enter a static date? if you have to use VBA, how do you open it? would it be google script? help!
i've tried this formula
=if(C1="true";if(C2;C2;now());"")
but it works only if is FALSE....and no data.
Replace your references to now() with lambda(x;x)(now()). Volatile functions (like NOW, RAND,etc.) can be made 'sticky' by encapsulating them in a LAMBDA like this.

uib-datepicker-popup: Only enabling certain dates for selection

The docs/examples don't seem to cover this use case, nor have I found an example for this.
If I've got a list of dates, and want all other dates in this Datepicker disabled, what's the hook that would allow this?
I started by trying to use customClass just to mark the selectable dates from my list, but there appears to be a bug such that customClass doesn't get called for uib-datepicker-popup.
Now I'm trying to use disable to mark all dates except those in my "available" list as disabled, but there doesn't seem to be a way to iterate over dates in a range to apply the disable callback.

How to retrict date on UIDatePickerView?

hi guys can any body help me to figure out that how i can restrict the minimum date in UIDatePickerView? i tried to set property minumumDate from xib file but it is not working, even i set the the mode like this
[datePicker setDatePickerMode:UIDatePickerModeCountDownTimer];
but still it is not working. what i want to do is that user cannot scroll down from a specific date. example: if restricted date is 21.11.2011 then user should not scroll it to less then this date so please help me to figure it out
Thanx in advance
I think you would want to set the mode to 'UIDatePickerDate', as 'UIDatePickerCountDownTimer' is meant to display a time. Have you tried:
[datePicker setDatePickerMode:UIDatePickerModeDate];
[datePicker setMinimumDate:minDate];
minDate would be an NSDate with the restricted date. For info on how to initialize this date, see here in the Apple documentation. Especially the part about date components.

How to make UITableView show current item?

I have an array filled with dictionaries.
Each dictionary have strings like title, info and date.
Cells in the table are arranged by the date from the dictionary.
What should I do to make it show the cell as active if the date field in dictionary=current date or closest date in the future?
Thanks in advance! I'd really appreciate your help!
I am assuming that you want to somehow highlight the current date. A simple thing would be to select the cell using [cell setSelected:YES animated:YES]. An other thing would be setting the accessoryType to UITableViewCellAccessoryCheckmark ([cell setAccessoryType:UITableViewCellAccessoryCheckmark]). If you don't like these approaches, you can still create a custom UITableViewCell with support of some sort of highlighting, like showing an arrow in the cell.

Must I retain the date from a UIDatePicker Modal View?

I'm getting crashes from my UIDatePicker view and I think it's because I'm not retaining the pickers selected date. Can anyone tell me if this could be correct?
I have a modal view for selecting a toDate and a fromDate range. These values are passed into the modal view and grabbed out of the view when it's dismissed.
The view has one UIDatePicker and a segmented button for switching between the to and from dates.
Every time the segmented control switches I set the pickers date to the matching to or from date. When the picker value changes I update the to or from dates accordingly. The view crashes after a couple of switches between these dates.
I'm not retaining the pickers selected date so I'm guessing when I set the value of the pickers date from the toDate to the fromDate the toDate is being released so when I switch the picker back to the toDate it's going to crash.
Also to use the selected date from the picker outside the view will the date need to be retained as the picker will be released along with the date?
Does this make sense to anyone?
If you need to grab the date value from a UIDatePicker, you indeed need to retain a copy if you'll be using it outside the scope of the function (say, over multiple AutoreleasePool cycles).
Getting the date from a UIDatePicker will retain a reference but it will be autoreleased so effectively is only valid until the autorelease pool is destroyed.
Remember to release your reference once you've finished with it.
For simply using it temporarily inside a function, you won't need to retain it as stated above.
Why don't you set a property of your viewvcontroller or other class to the date you get using:
self.date = date;
Define date to be a #property with a retain attribute. That way you should be able to use date in other places of your app, and it won't be autoreleased when you go through the runloop.