---
title: "tableview设置上下滚动高度，启用删除"
author: "zcw_java"
date: "2013-08-06T17:14:03Z"
tags: []
categories: ["移动开发"]
slug: "tableview"
draft: false
lastmod: "2013-08-20T15:50:25Z"
id: 1921039
url: "https://zcw-java.iteye.com/blog/1921039"
---

可在viewDidAppear中实现加入 ［tablvew setContentOffset:CGPointMake(0,480) animated:YES］；  
在tableView内添加一个searchbar，一起滚动；开始时隐藏headerView（即让tableView向上滚动headerView的高度：默认44）  
UISearchBar *mySearchBar =  init];  
;  
  
tableView.tableHeaderView = mySearchBar;  
//UITableView开始滚动到的位置（这样一开始headerView是不显示的）  
;  


//启用删除
- (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
    CustomAlarmCell *cell = (CustomAlarmCell*);
    ;
    ;
    ;
}

- (void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
    CustomAlarmCell *cell = (CustomAlarmCell*);
    ;
    ;
    ;
}