了解更多IOS底层原理知识,关注腾讯课堂八点钟学院IOS高级开发
IOS学习交流群 431449751;
Tableview删除属性,代码如下
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
returnYES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}
- (NSString*)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
return@"删除";
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle ==UITableViewCellEditingStyleDelete)
{
。。。。。。。。
if([infoDictwriteToFile:mokaoPlistFilePathatomically:NO])
{
[temAry removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArrayarrayWithObject:indexPath]withRowAnimation:UITableViewRowAnimationFade];
}
else
{
}
}
}
如果遇到有手势冲突, 需要传递手势下去,代码如下
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {if([[touchview]isKindOfClass:[ExamdaLoadCellclass]]) /// 手势发生在cell上,不让改手势接收事件
return NO;
}