现在的位置: 首页 > 综合 > 正文

UITableView启动后自动设置滚动的位置

2018年02月13日 ⁄ 综合 ⁄ 共 476字 ⁄ 字号 评论关闭

  1. 可在viewDidAppear中实现加入 [tablvew setContentOffset:CGPointMake(0,480) animated:YES];  
  2. 在tableView内添加一个searchbar,一起滚动;开始时隐藏headerView(即让tableView向上滚动headerView的高度:默认44)  
  3. UISearchBar *mySearchBar = [[UISearchBar alloc] init];  
  4. [mySearchBar sizeToFit];  
  5.   
  6. tableView.tableHeaderView = mySearchBar;  
  7. //UITableView开始滚动到的位置(这样一开始headerView是不显示的)  
  8. [tableView setContentOffset:CGPointMake(0.0, 44.0) animated:NO];  

转自:http://blog.csdn.net/a6472953/article/details/8443242

抱歉!评论已关闭.