I have tried this code. http://www.mediafire.com/download/bvoqrkn82sd6az9/tablesample.zip ..Here, It will display the Table View. But I need to create a tableview whenever I click the button, it should display the list of Tableview like dropdown as it is in this screenshot. http://www.mediafire.com/download/7jiwb0e00916gh9/Table+View.PNG This is what I need to display. Your help is highly appreciated. Thanks in advance.
Asked
Active
Viewed 1.4k times
3
-
1you can make it hidden on default, and on button click make your table view to be appeared – muneebShabbir Oct 28 '13 at 06:18
-
This is what I was stuck up. How could I do the button to be hidden and whenever I click it, it should open the tableview ? – Dinesh Kumar Oct 28 '13 at 06:21
-
select your tableview and then from your interface builder or interface panel check the check box with title hidden. make IBoutlet of your table and on button action set its hidden property to 'NO' – muneebShabbir Oct 28 '13 at 06:24
-
I haven't used storyboard here. All the controls UITable View are dynamic. That's what stucked to create a button there.. – Dinesh Kumar Oct 28 '13 at 06:26
-
that will be more easy, every view has property `hidden` so when you create your tableview set its property to `YES` and on button click change its property to `NO` – muneebShabbir Oct 28 '13 at 06:28
-
do u want drop down table or expandable cell ...?? – Arun Oct 28 '13 at 06:28
-
i think Dinesh wants a table view to be appeared when user clicks on button in Nav bar – muneebShabbir Oct 28 '13 at 06:29
-
Ya. Right muneeb. First of all, I need to create a button in nav bar. Can you please tell me how to do that? as like in the screenshot – Dinesh Kumar Oct 28 '13 at 06:32
-
1simple place a button on the Nav bar and set the table initial Height as 0 and for uiview animate with delay 0.7 and height to required one – Arun Oct 28 '13 at 06:32
-
@Spynet: That's what I am stucking. Couldn't place a button in nav bar. – Dinesh Kumar Oct 28 '13 at 06:33
-
@DineshKumar do u need code or entire project ??? – Arun Oct 28 '13 at 06:34
-
can you share the code how you are setting your navigation button? – muneebShabbir Oct 28 '13 at 06:34
-
This is the project I have done so far. http://www.mediafire.com/download/bvoqrkn82sd6az9/tablesample.zip I need to create a button in nav bar and if I click the button, it should display the list of table view. Please edit in this code itself. – Dinesh Kumar Oct 28 '13 at 06:36
-
@DineshKumar task for me or muneebShabbir – Arun Oct 28 '13 at 06:39
-
@muneebShabbir r u doing this one – Arun Oct 28 '13 at 06:40
-
any of you can solve a problem please. Your help is highly appreciated – Dinesh Kumar Oct 28 '13 at 06:42
-
@spynet: no :p coz currently not working on mac projects so currently running windows – muneebShabbir Oct 28 '13 at 06:49
-
@Spynet: can you please? – Dinesh Kumar Oct 28 '13 at 06:55
-
@Spynet: Are you doing it bro? – Dinesh Kumar Oct 28 '13 at 07:04
-
I have added this code UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Right" style:UIBarButtonItemStylePlain target:self action:@selector(method:)]; self.navigationItem.rightBarButtonItem = anotherButton; in viewdidload method of dkhomeviewcontroller.m..I have created a button. But I need to display the table view whenever I click the button – Dinesh Kumar Oct 28 '13 at 07:07
-
s i finished uploading – Arun Oct 28 '13 at 07:16
-
can you please provide me the link ? – Dinesh Kumar Oct 28 '13 at 07:17
-
i posted the answer pls check and update me..... – Arun Oct 28 '13 at 07:20
-
let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/40101/discussion-between-spynet-and-dinesh-kumar) – Arun Oct 28 '13 at 08:02
-
Try this.. http://stackoverflow.com/a/34586224/3908884 – Meet Doshi Jan 06 '16 at 05:34
3 Answers
3
You can change height of tableView with animation. Set time according your suitability.
For Expansion:
[UIView animateWithDuration:1
delay:0.0
options: UIViewAnimationYourChoice
animations:^{
CGRect frame = self.tableView.frame;
frame.size.height = 300;
self.tableView.frame = frame;
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
For shrinking:
[UIView animateWithDuration:1
delay:0.0
options: UIViewAnimationYourChoice
animations:^{
CGRect frame = self.tableView.frame;
frame.size.height = 0;
self.tableView.frame = frame;
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];

Krishna Kumar
- 1,652
- 9
- 17
1
There is no option for dropdwon in IOS SDK. If you need this follow like this.
- On the click of this button you'll have to load a UIView or UITableView which will come exactly down to your UIButton.
- This custom UIView or UITableView will act as your drop down.
- Once your use is complete you can either hide it or remove it.
I hope it will hepl you.. Instead of dropview you can use UIPopoverController to show the UITableView

TamilKing
- 1,643
- 1
- 12
- 23
0
I have implemented this , You can achieve this by adding the button on the first row of any section and load other rows by the click on the first row with UITableViewRowAnimationTop
using beginUpdate.
So now every first row of the section with index==0 will be a dropdown button and other rows starting from index=1 will be your data rows representing the information.

Dushyant Singh
- 721
- 4
- 13