如何在iPhone上的WhatsApp之类的UITableView背后实现隐藏的群聊按钮

时间:2011-09-07 13:51:53

标签: iphone uitableview uiview uibutton uisearchbar

我有兴趣在iPhone上的WhatsApp上实现UITableView背后的隐藏按钮。用户第一次访问Chats TabBar,UISearchBar和GroupChat Button被隐藏,当用户向下滚动TableView时,会出现GroupChat Button。

enter image description here

我尝试通过IB创建该UI,但我无法点击按钮。这是IB视图层次结构:

UIView  
-->UIButton  
-->UITableView  
   -->UIView (UIView as TableView's header)  
      -->UISearchBar

我将UIView高度设置为88,将clearColor设置为BackgroundColor< - (包含UISearchBar的UIView)。然后我将UISearchBar Y位置设置为44。 在- (void)viewDidLoad我这样做

[self.tableView setContentOffset:CGPointMake(0.0, 44.0) animated:YES];

实现UI行为的最佳方法是什么?任何帮助将不胜感激。

此致

1 个答案:

答案 0 :(得分:-1)

 [self.tableView reloadData];

[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]
                      atScrollPosition:UITableViewScrollPositionMiddle animated:NO];