Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

ios - How to show the TableView (like dropdown) on Button Click in iPhone?

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.

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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!");
                         }];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...