I am making a small program and I ran into a small problem. I need to pop up a UIDatePicker in my UITableViewController. Any help will be appreciated. I want the UIPickerView to appear when a button is pressed. I wanted the UIPickerView to be hidden and when the user presses the button it becomes visible. But since I can't place the UIDatePicker in my UITableViewController that can't happen. Is there another way?
Asked
Active
Viewed 318 times
1
-
1You need to be more specific. When should the date picker appear? How? What have you tried so far? – rmaddy Jul 13 '13 at 04:01
-
I tried to enter my UIDatePicker into the storyboard in my UITableViewController. – Abdullah Shafique Jul 13 '13 at 04:05
-
That doesn't explain when or how you want the picker to appear. Your question can't be answered in its current form. It is too vague. – rmaddy Jul 13 '13 at 04:07
-
you can add datepicker on one uiview and display it on button tapped – Agent Chocks. Jul 13 '13 at 04:17
-
@AbhijitChaudhari Do you mean a container view? – Abdullah Shafique Jul 13 '13 at 04:18
-
@Abdullah Shafique yes – Agent Chocks. Jul 13 '13 at 04:25
-
@AbhijitChaudhari I tried to add a container to my table view but it won't work. – Abdullah Shafique Jul 13 '13 at 04:27
-
http://stackoverflow.com/questions/8484147/how-do-i-make-a-modal-date-picker-that-only-covers-half-the-screen pls check this? – Anjaneyulu Jul 13 '13 at 04:29
-
@Abdullah Shafique you need to create one view controller add uitableview on it and then add uiview – Agent Chocks. Jul 13 '13 at 04:50
-
@AbhijitChaudhari I wish I could. I am using static cells and I can not do that unless in a UITableViewController. – Abdullah Shafique Jul 13 '13 at 04:53
2 Answers
0
I found my solution! I decided to create the UIDatePicker with my code. I used:
dtpPicker = [[UIDatePicker alloc]init];
dtpPicker.frame = CGRectMake(0, 0, 480, 162);
[self.view addSubview:dtpPicker];
Thanks for everyone who helped me!

Abdullah Shafique
- 6,878
- 8
- 35
- 70
0
[self.tableView addSubview:dtpPicker];
if tableview
in view.

Roman C
- 49,761
- 33
- 66
- 176

user2094867
- 299
- 2
- 7