`
zcw_java
  • 浏览: 296800 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

tableview设置上下滚动高度,启用删除

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


//启用删除
- (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
    CustomAlarmCell *cell = (CustomAlarmCell*)[tableView cellForRowAtIndexPath:indexPath];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelay:.1f];
    [UIView commitAnimations];
}

- (void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
    CustomAlarmCell *cell = (CustomAlarmCell*)[tableView cellForRowAtIndexPath:indexPath];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelay:.1f];
    [UIView commitAnimations];
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics