如何在iPhone上的按钮单击下拉列表中显示tableview?

Din*_*mar 1 iphone objective-c uitableview buttonclick ios

我试过这段代码.http://www.mediafire.com/download/bvoqrkn82sd6az9/tablesample.zip ..在这里,我需要这样..每当我点击显示按钮时,它应该显示Tableview列表,如下拉屏幕截图所示.加载时,应隐藏表视图.单击按钮时,应显示tableview.非常感谢您的帮助.提前致谢.在此输入图像描述

Kri*_*mar 5

您可以使用动画更改tableView的高度.根据您的适合性设定时间.

扩展:

[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!");
                         }];
Run Code Online (Sandbox Code Playgroud)

缩小:

[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!");
                         }];
Run Code Online (Sandbox Code Playgroud)