美文网首页
tablewView(cell前是圆圈选择)

tablewView(cell前是圆圈选择)

作者: 我是菜鸟66666 | 来源:发表于2016-08-06 15:54 被阅读0次

viewTableView =[[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];

[viewTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:reuseIdentifier];

//    [tableView setEditing:YES];

//    viewTableView.allowsMultipleSelectionDuringEditing=YES;

viewTableView.delegate=self;

viewTableView.dataSource=self;

[self.view addSubview: viewTableView];

//导航条的编辑按钮

self.navigationItem.rightBarButtonItem = self.editButtonItem;

//重写编辑的方法 (重点除非类继承tableview或者tableviewControllers否则都要重写这个方法来进入编辑状态)

-(void)setEditing:(BOOL)editing animated:(BOOL)animated {

[super setEditing:editing animated:animated];

[viewTableView setEditing:editing animated:animated];

}

//选择删除的cell前面带圆圈的选择删除(重点)

#pragma mark - Table view data source

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {

return UITableViewCellEditingStyleDelete| UITableViewCellEditingStyleInsert;

}

//删除添加代理

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

if (editingStyle == UITableViewCellEditingStyleDelete) {

// Delete the row from the data source

//        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];

} else if (editingStyle == UITableViewCellEditingStyleInsert) {

// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view

}

}

相关文章

  • tablewView(cell前是圆圈选择)

    viewTableView =[[UITableView alloc]initWithFrame:self.vie...

  • iOS中UITableViewCell的高度缓存

    过程:在model中添加描述cell高度的字段;在cell显示前(不是cell加载时)计算出cell的实际高度。 ...

  • iOS关于cell点击更换背景颜色

    具体的步骤是三个,第一步设定cell选择状态下的背景view // cell.selectionStyle = U...

  • UITableViewCell 点击弹出 UIAlertCont

    目前遇到这种情况是在 cell 的选择状态 selectionStyle 设为 UITableViewCellSe...

  • 《生活是圆圈》

    她 玉指当空比划着 缓慢地顺时针 绕成一个圆圈 并且轻声说 生活就是转着圈 最终会回到原点 其中有上有下 想明白就...

  • 什么是圆圈?

    首先在词源上稍作探讨。“圆”在甲骨文中表示鼎口,鼎口一般为圆形。“圈”字意为“将家畜关在围起的栅栏里饲养”。引申有...

  • UITableView ReloadData时 animateW

    今天遇到一个问题,在UITableView选择cell后reloadData的时候执行cell上的animateW...

  • iOS tableview上的cell莫名消失

    在项目中我发现了这样一个bug,在cell上有选择图片的按钮,我选择完图片后,tableview的cell会消失。...

  • 圈圈圆圆圈圈

    圈圈圆圆圈圈 圆圆圈圈圆圆 圈圈圆圆 圆圆圈圈 圈圈圈圆 圆圆圆圈 圈圆圆圈 圆圈圈圆 圈圆圈圆 圆圈圆圈 圈圈圆...

  • 知识好像一个圆圈

    芝诺:人的知识就好比一个圆圈 人的知识就好比一个圆圈,圆圈里面是已知的,圆圈外面是未知的。你知道得越多,圆圈也就越...

网友评论

      本文标题:tablewView(cell前是圆圈选择)

      本文链接:https://www.haomeiwen.com/subject/krbksttx.html