如何显示button上的TableView(如下拉列表)在iPhone中单击?

我已经试过这个代码。 http://www.mediafire.com/download/bvoqrkn82sd6az9/tablesample.zip ..在这里,它将显示表格视图。 但是,我需要创build一个tableview,每当我点击button,它应该显示Tableview的列表像下拉,就像它在这个截图。 http://www.mediafire.com/download/7jiwb0e00916gh9/Table+View.PNG这是我需要显示的。 您的帮助是高度赞赏。 提前致谢。

在这里输入图像说明

你可以用animation改变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!"); }]; 

缩小:

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

IOS SDK中没有dropdwon的选项。 如果你需要这样的话。

  1. 点击这个button,你将不得不加载一个UIView或者UITableView,这个UIVutView会直接到你的UIButton。
  2. 这个自定义UIView或UITableView将作为你的下拉菜单。
  3. 一旦你的使用完成,你可以隐藏它或删除它。

我希望它会hell你..而不是dropview你可以使用UIPopoverController来显示UITableView

我已经实现了这一点,你可以通过在任何部分的第一行添加button来实现这一点,并通过使用beginUpdate在UITableViewRowAnimationTop上单击第一行来加载其他行。

因此,现在索引== 0的部分的每一行都将是一个下拉button,而从索引= 1开始的其他行将是代表信息的数据行。