在我们的app开发当中,经常会用到UITableView 的左滑删除的功能,通常的话效果如下
下面我们就开始实现,类似的做法
首先是tableView的代理方法,各种数据源方法的实现
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.dataArr.count;
}
-(UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *identifier = [NSString stringWithFormat:@”identifier:%d”,(int)indexPath.row];
TestTableViewCell cell = (TestTableViewCell )[tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell)
{
cell = [[TestTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
}
[cell setBackgroundColor:[UIColor whiteColor]];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
iOS开发中实现UITableView的Cell左划删除等自定义功能
最新推荐文章于 2022-07-15 10:07:49 发布