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.
Related
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.
So I cannot provide you with any code, but it's quite simple what I want to achieve.
I am searching for a way to get the selected value from an UIPickerView in iOS 8 (Swift)
these pickerviews have a custom delegate & data source.
So the method of didSelectRow is accessed in a custom class, not the ViewController, but I would have to be able to get the selected value and use it in the ViewController. Let's say, place it in a textbox.
I can't find a way to do this, should I try to access the delegate itself or what should I be doing?
Care to share your knowledge with the students of Application Development? :)
The UIPickerView class has a method named: `selectedRowInComponent'. This function may help you select components in a picker view. Apple Documentation for UIPickerView class would help you with your project.
Also make sure your view controller conforms to the UIPickerViewController Delegate and Data source.
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
}
I want the same style as in UIDatePicker, but in stead of choosing a date I want to choose a number. Is this possible?
Use for that UIPickerview and it's datasource and delegates methods as for UITableView.
See this post
Im trying to create a view with two pickers, each with multiple components, one of the pickers has 4 components that are all text based, the other has two components that need to display graphics and two that need to display text. Is there any way to use the pickerView:titleForRow:forComponent:(NSInteger)component delegate method and the pickerView:viewForRow:forComponent:reusingView: delegate method for the same picker?
I've implemented both, only the viewForRow one seems to ever get called. Do I need to just use that one and create a view with a label for each row?
You can create one picker, yes, or you can implement one common method for both pickers and determine what picker is calling it by checking it's tag.
The Solution I cam up with was to call pickerView:titleForRow:forComponent: from pickerView:viewForRow:forComponent:reusingView: and create a UILabel with the string from the first method. It works, but it seems like there ought to be a better way.