ios – 如何在iPhone上的Button Click上显示TableView(如下拉列表)?

前端之家收集整理的这篇文章主要介绍了ios – 如何在iPhone上的Button Click上显示TableView(如下拉列表)?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试过这段代码. http://www.mediafire.com/download/bvoqrkn82sd6az9/tablesample.zip ..在这里,它将显示表格视图.但是每当我点击按钮时我都需要创建一个tableview,它应该显示Tableview列表,就像在这个截图中一样下拉列表. http://www.mediafire.com/download/7jiwb0e00916gh9/Table+View.PNG这是我需要展示的内容.非常感谢您的帮助.提前致谢.

解决方法

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

扩展:

  1. [UIView animateWithDuration:1
  2. delay:0.0
  3. options: UIViewAnimationYourChoice
  4. animations:^{
  5. CGRect frame = self.tableView.frame;
  6. frame.size.height = 300;
  7. self.tableView.frame = frame;
  8. }
  9. completion:^(BOOL finished){
  10. NSLog(@"Done!");
  11. }];

缩小:

  1. [UIView animateWithDuration:1
  2. delay:0.0
  3. options: UIViewAnimationYourChoice
  4. animations:^{
  5. CGRect frame = self.tableView.frame;
  6. frame.size.height = 0;
  7. self.tableView.frame = frame;
  8. }
  9. completion:^(BOOL finished){
  10. NSLog(@"Done!");
  11. }];

猜你在找的iOS相关文章