//在viewDidLoad方法中创建Toolbar
toolbar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 66)]; toolbar.backgroundColor = [UIColor redColor]; //添加到tableView中
[self.tableView addSubview:toolbar];
//在当前继承UITableViewController的视图控制器中实现此方法(y值:self.tableView.contentOffset.y)
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
toolbar.frame = CGRectMake(0, self.tableView.contentOffset.y , 320, 66);
}
5月24号有了新的想法: 1.让当前控制器继承UIViewController,实现UITableViewDataSource和UITableViewDelegate。 2.定义UITableView,创建好了tableView之后,把tableView添加到当前控制器的view中,设置好tableView的frame。 3.自定义Toolbar,把toolbar也添加到当前控制器的view中。 这样Toolbar就不会随着cell的移动而移动了。 智商不行,到现在才想到...