inline date picker implementation - ios

i am developing an application which is retrieve some data from a web service and show them in a table view.i want to filter the data on the date.so i have tried to implement a in line date picker. so i have successfully done an exercise by help of this.
so i have a question : as i know, all the rows are filled to the table view via cellForRowAtIndexPath method. can i do such a thing like , when i select a date from the inline date picker, it should be load the cells by calling the web service according to the date..
simply , first of all all the cells should be empty. when we touch the top most cell , in line date picker is showed. after we select the date, then the cells should be loaded.. can i do that ? if it is ,can some one give me some idea how to do that? please guide me with some links , code samples ideas.. anything....
thank you

try like this take picker in Xib and connect it properly, And set IBAction as ValueChanged
after that call this method while changing the date
-(IBAction)datePickerValueChanged: (id)sender {
NSDate *selectedDate = [sender date];
NSLog(#"%#",selectedDate);
//do something with selectedDate
}

Related

How to make a picker view dynamically in Xcode in objective c?

I am newbie in iOS.I a trying to make picker view in a navigation toolbar my dates are coming their sucessfully.I need to make a Picker view which fills datasource with 2 names and on selection of it i need to return it in string so that I can apply a sql query on it.
I have already mentioned the method of picker view for making my dates come their.
The issue is that I need picker views one which selects the date and other which shows 2 name For e.g 1)Emergency 2)Synergy11.I need to fill both in the picker view. Please let me know.

same behavior as "Starts" text/date picker in iOS/iPhone calendar

I am trying to learn ios development. I want to simulate the same behavior as I get when I Tap the "Starts" row in iphone calendar app
Same row has the column name "Starts" with default value of Datepicker.date
When I tap on the row, it expands (pushes next row down) and brings up date picker
Right now, I have a text field with its input set to date picker value.
UIDatePicker *datePicker = [[UIDatePicker alloc]init];
[datePicker setDate:[NSDate date]];
[self.timeTextField setInputView:datePicker];
In my case date picker, comes bottom up.
Please help
As written, your question is too broad, and too much of a "spoon-feed me a complete solution to my problem" question. You're much more likely to get help if you try specific things and ask questions about the problems you have in implementing those things.
Break it down into parts. What are the sub-parts, and what are you able to do on your own? Have you created a date picker and set it to a default date yet?
Are you looking for help with inserting a date picker as a new cell in a table view immediately below the "starts" cell? are you looking for help with making changes to the picker update the "starts" date cell immediately?
Again, break it into parts and tackle each part separately. First, simply create a date picker on it's own window and learn how to use it. Then add a label under the date picker, set yourself up as the picker's delegate, and display the date the user selects in the picker into the label.
Then figure out how to set a date picker to a specific date, and/or set the earliest/latest date the picker will accept.
Now figure out how to make a table view respond to taps on a row (try didSelectRowAtIndexPath). Then look at the animated methods for inserting a new row into a table view.
If you have trouble, post back with specific questions on the trouble you are having.

How to pass date into picker view in ios

I just want to pass date in to picker view and other next component I want to pass another array. But for first component of rows I need to show date in picker view.
Please help me out.
You have to use two separate picker views, a UIDatePicker, and a UIPickerView. Read up on the documentation of the UIPickerViewDelegate and UIPickerViewDataSource to populate it with your array.

Get selected row of UIDatePicker while spinning

I have a UIDatePicker in a view whose controller is in a UINavigationController. I'm registering changes in the selected date like this:
[self.datePicker addTarget:self.alarm action:#selector(timeChanged:) forControlEvents:UIControlEventValueChanged];
It works well, except if the user presses the back button in the UINavigationController before the date picker has completely settled. In that case, the timeChanged: method isn't being called, and so I'm not getting the new date.
Nothing is being released when I press the back button, it's just that the view controller is being popped off. (A reference to it is maintained).
I've found solutions to this problem with UIPickerView that involve implementing delegate methods for the picker view (eg: UIPickerView: Get row value while spinning?). But unless I'm very mistaken, that's not an option with a UIDatePicker. If possible, I'd like to stick with the UIDatePicker rather than a custom UIPickerView. Is there a way to do this? It doesn't have to get the selected row perfectly (within a row or two is fine), but the closer the better.
EDIT: This is for a jailbreak app, so private APIs are fine, if I can figure out what they are.
As for the current APIs, there's no way of detecting whether a UIDatePicker is spinning.
This is because UIDatePicker is not a subclass of UIPickerView and it manages a UIPickerView internally.
I'm afraid the best solution here is to use a custom UIPickerView.

Kal Calendar Walkthrough

I am new to obj c and I am not understanding how to use Kal Calendar. Would anyone be willing to help a new app developer walk through the process? I have it installed to my app but don't know how to use it. I understand if you don't respond, I cant find any tutorials on it and google only helped a little.
I am using ios5, storyboards and arc. Thanks in advance.
I had to subclass the calendar with storyboards, is this the best way? I cant get it to display with a navbar any other way.
UPDATED-I don't think subclass is the way to go but I am still working on a solution
I created a view controller to contain the calendar view controller(KalViewController). That view controller is the KalViewControllerDelegate and datasource. I add the KalViewController as a child view controller using the containment introduced on iOS 5. I added the parent view controller of the KalViewController to a popover controller (on an iPad application). I present it from where I wanted to (UIBarButtonItem). The job of the parent view controller is to provide dates for the calendar view, and to provide data to the table view.
Edit: Here's what you need to do:
on
- (void)presentingDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
You need to find your dates (Network, database, etc). Once you fetch the information containing the dates, you call [delegate loadedDataSource:self];
- (NSArray *)markedDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate
This is to show the dates that are marked on the calendar (the ones with the little dot to mark an event on a particular day). Here you use the dates from your model to find the ones that are going to be visible on the calendar for a month.
- (void)loadItemsFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate
This will be called when the user selects a day of a month. This should be used to update the list of objects being shown on the tableview datasource. So, if you keep an array with the dates for the calendar table, update the array with the data for the given day.
and finally:
- (void)removeAllItems
clear your tableview datasource array.
You also have to implement the Calendar's tableview datasource and delegate methods.

Resources